alphapapa / org-ql

A searching tool for Org-mode, including custom query languages, commands, saved searches and agenda-like views, etc.
GNU General Public License v3.0
1.35k stars 104 forks source link

Results not inserted after org-babel-execute subtree #324

Open johanwk opened 1 year ago

johanwk commented 1 year ago

I have an emacs-lisp source block with an org-ql-query. When executed interactively with C-c C-c, it inserts the wanted table of results into the buffer.

However, when calling org-babe-execute-subtree, the org-ql results are not added to the buffer/updated. Other emacs-lisp blocks work fine (results are inserted).

Is this as intended, or a bug?

alphapapa commented 1 year ago

Hello Johan,

I don't know how org-babel-execute-subtree is implemented, so I don't know why it would behave differently than using C-c C-c, and I don't know how org-ql-query's implementation could affect that behavior.

A hunch: you might be encountering an issue related to org-ql's per-buffer query results caching. Try this: kill the buffer, open the file again, then run org-babel-execute-subtree and see if it does anything the first time.

johanwk commented 1 year ago

Thanks for the advice! Unfortunately, kill--reopen--rerun doesn't help.

What I do see is a new line with #+RESULTS:, but the table doesn't appear in the buffer.

alphapapa commented 1 year ago

Ok, well, I haven't seen your code or configuration, and org-ql-query is just a function that returns a value, like any other Elisp function, so at this point I can only advise you to consult the Org Babel documentation and source code. If there is some peculiar interaction somewhere, you'll have to study the source code to find it. But it's more likely to be a misunderstanding or a configuration problem, so you should also try to reproduce on a clean Emacs configuration with the latest released versions of the relevant software.