alphapapa / org-ql

A searching tool for Org-mode, including custom query languages, commands, saved searches and agenda-like views, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Symbol's function definition is void: org-ql-block

gcantieni opened this issue · comments

Hi there, for me it looks like org-ql-block is pointing to a non-existent function. When I run the example usage:

(setq org-agenda-custom-commands
      '(("t" "Custom: Agenda and Emacs SOMEDAY [#A] items"
         ((org-ql-block '(and (todo "SOMEDAY")
                              (tags "Emacs")
                              (priority "A"))
                        ((org-ql-block-header "SOMEDAY :Emacs: High-priority")))
          (agenda)))))

When I try to run this I get Symbol's function definition is void: org-ql-block. Additionally, when I call describe-function on org-ql-block I get:

org-ql-block is an alias for ‘org-ql-search-block’, which is not
defined.  Please make a bug report.


Not documented.

Hi,

That alias is autoloaded, so if it isn't working, I guess the package isn't installed correctly.

@gcantieni Thanks for your report. Comments on #75 have shown that there is a bug here. Steps to reproduce from my comments there:

  1. Start a clean Emacs config in a sandbox using https://github.com/alphapapa/alpha-org/blob/master/emacs-sandbox.sh.
  2. M-x package-install RET org-ql RET.
  3. Make and save test file:
* [#A] Heading                                                        :Emacs:
blah
  1. Add to agenda files with C-c [.
  2. Evaluate this Elisp:
(let ((org-agenda-custom-commands
       '(("a" ""
	  ((org-ql-block '(and 
                              (tags "Emacs")
                              (priority "A"))
			 ((org-ql-block-header ":Emacs: High-priority"))))))))
  (org-agenda nil "a"))

Output:

:Emacs: High-priority
  [#A] Heading                                                                                  :Emacs:
  1. Kill Emacs.
  2. Restart Emacs with the same config.
  3. Re-open the Org file.
  4. Repeat steps 4 and 5.

Result: A backtrace saying that org-ql-block is a void function.

However, then:

  1. C-h f org-ql-block RET to show the help buffer:
org-ql-block is an alias for ‘org-ql-search-block’ in
‘org-ql-search.el’.

Then:

  1. Repeat step 5.

Result: the agenda block is displayed properly, without error.

Also, these steps seem to indicate that the alias is loaded into Emacs, but the function is still void:

  1. Exit Emacs.
  2. Restart Emacs with the same config.
  3. C-h f org-ql-block RET.

Result:

org-ql-block is an alias for ‘org-ql-search-block’ in
‘org-ql-search.el’.

(org-ql-block QUERY)

Insert items for QUERY into current buffer.
...

Unlike the error message reported by @gcantieni, this shows that org-ql-search-block is loaded and defined, but when the example agenda code is run, the alias function is void. Loading org-ql-search fixes the problem, but it shouldn't be necessary, because the autoload should take care of it.

org-ql-search.el defines the alias like this:

;;;###autoload
(defalias 'org-ql-block 'org-ql-search-block)

For some reason that's not causing the alias to work, even though describe-function shows that it is loaded. More investigation will be required.

In the meantime, users can (require 'org-ql-search) in their Emacs configs to force the file to load and define the function and alias.