-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to run usual org functions like refile or schedule on results from org-ql or org-ql-search #35
Comments
This works as a workaround for me:
Strangely, simply setting org-agenda-type in the agenda buffer doesn't work, its value remains nil. |
Thank you, works perfectly. |
@AloisJanicek Yes, as noted in the readme:
@mz-pdm Yes, after some quick testing, I also found the I don't know what the best solution is. I don't think we should be advising functions to work around this in |
The following piece of code, when placed to org-agenda-finalize-hook, makes org-agenda-do-date-later and org-agenda-do-date-earlier (S-right, S-left) commands working: (goto-char (point-min))
(while (not (eobp))
(let* ((scheduled (org-get-at-bol 'scheduled))
(pos (and scheduled (plist-get (cadr scheduled) :begin)))
(marker (org-get-at-bol 'org-marker)))
(when (and pos marker)
(move-marker marker pos (marker-buffer marker))))
(forward-line)) Advising the commands with org-agenda-type as outlined above is additionally needed. |
@mz-pdm I don't understand what that code is doing, but we definitely can't be doing anything like that in this package. We can't advise any |
What the code does is moving org-marker, present in the entry properties, from the beginning of a scheduled entry to its SCHEDULED: date. This is what the org-agenda-do-date-* functions require. It's a workaround I use to make the functions working, which makes my org-ql-block agenda functionality fairly complete. |
I am not sure why this is designed in such way, I am not a emacs lisp expert, but I think there are two bits that making this unsetteble outside. Frist one is in org-agenda-finalize function which setting org-agenda-type based on text properties from agenda buffer:
The second one is org-agenda-update-agenda-type which is basically do the same but in post-command-hook:
Also reading org-ql-agenda-buffer reports that this property is set to nil. I checked practically every symbol in the buffer, but sorry! No luck. Fortunetly hacking org-ql package was very easy. First function in "Faces/properties" section is the function that is applying properties to the text that will appear in the buffer. Here is the patch:
Although, shifting entires with "org-agenda-do-date-earlier" and similiar still not working, it reports that timestamp was not found. Probably is should be text properties too? Anyway, for me org-schedule is enough and I set org-agenda-type to 'search. I believe it suits org-ql buffers better. |
Some functions in org-agenda checking against org-agenda-type variable to ensure that this action is valid to run in that type of agenda. Notably this fix running 'org-agenda-schedule' and 'org-agenda-deadline' functions. Also setting agenda type to 'search' prohibits some of the functions that are still not working on in these buffers, like "org-agenda-do-date-earlier".
Some functions in org-agenda checking against org-agenda-type variable to ensure that this action is valid to run in that type of agenda. Notably this fix running 'org-agenda-schedule' and 'org-agenda-deadline' functions. Also setting agenda type to 'search' prohibits some of the functions that are still not working on in these buffers, like "org-agenda-do-date-earlier".
Hi Mikhail, Thank you very much for doing that research, and for sending the PR. I will see about merging it soon. |
This should be fixed now (at least, for some commands, like scheduling and deadlines). Thanks to all for your help here. |
Some org-agenda commands check the org-agenda-type text property to ensure that the command is valid to run in that type of agenda. Notably this fixes running commands org-agenda-schedule and org-agenda-deadline. Setting the type to "search" prohibits some of the functions that are still not working in these buffers, like org-agenda-do-date-earlier. Fixes #35.
I've just noticed that you can't use functions like
ororg-agenda-refile
org-agenda-schedule
on result items when usingorg-ql
ororg-ql-search
. I even tried puttingorg-ql-block
intoorg-agenda-custom-commands
as shown in README, and I got same result.For example running
org-agenda-schedule
returnsorg-agenda-check-type: No Org agenda currently displayed.
I kind of understand that org-ql buffers probably aren't usual org-agenda buffers and that org-ql is still in development, so at this point I am just asking if this is an expected behavior or some kind of issue on my side and if former, is there currently any way to use org-ql and be able to manipulate org items directly from results' buffer?
The text was updated successfully, but these errors were encountered: