More agenda commands in org-ql-view (fix proposed)
egstatsml opened this issue · 4 comments
OS/platform
Linux
Emacs version and provenance
29.3, built from source
Org version and provenance
9.7.3 built with Elpaca
org-ql package version and provenance
0.9-pre
Description
Firstly, thanks Adam for all your packages. I, like many people see huge benefit from them and really appreciate all your hard work.
Secondly this is low priority as I already have a fix, more to get feedback and whether a PR for something like this is in scope and for others too use should they like. If not feel free to close :)
This feature request is add some more org-mode task management commands to the agenda like org-ql-views. Thinking of things like clocking in/out, setting priorities, undoing a TODO
set to DONE
, etc.
These are just the few I have found, and I have made a generic advice that works well for me so far, so just sharing it here in case others might want to use it, or feedback if you think of a better way to add these features I might try tackle them. I figure advice would not be the best way to go about making a more robust solution, but what I have works good enough for me. If you any feedback I might try tackle a PR at this should my elisp chops and time permit.
Edit: I was using advice to set a buffer local boolean to true when in an org-ql buffer but didn't actually work so am now just using buffer name match.
;; defining some advice so I can use some org agenda commands in
;; org-ql views
(defun org-ql-view-advice (orig-fun &rest args)
"Org-mode commands in org-ql-view buffers
Advise some org commands in org-ql views all this done is call
(org-agenda-switch-to), which will switch to an org buffer containing the todo
item. then will just call the original org command and will just return.
"
(if (s-contains? "Org QL View:" (format "%s" (current-buffer)))
;; if org-ql-view-buffer
(progn
;; switch to org file and apply command
(save-window-excursion
(org-agenda-switch-to)
(apply orig-fun args))
;; refresh org-ql-view
(org-ql-view-refresh))
(apply orig-fun args)))
;; advice functions
;; add more as they come in and I notice them.
;; Undo would be good, set priority, more as I notice them
(advice-add 'org-clock-out :around #'org-ql-view-advice)
(advice-add 'org-clock-in :around #'org-ql-view-advice)
(advice-add 'org-priority :around #'org-ql-view-advice)
(advice-add 'org-priority-up :around #'org-ql-view-advice)
(advice-add 'org-priority-down :around #'org-ql-view-advice)
(advice-add 'org-priority-down :around #'org-ql-view-advice)
Etc.
No response
Firstly, thanks Adam for all your packages. I, like many people see huge benefit from them and really appreciate all your hard work.
Hi, thanks for the kind words. I'm always glad to hear that my work is useful (and I only hear from a small fraction of users).
I'm not sure why you're finding it necessary to use those advices. An org-ql-view
buffer imitates an org-agenda-mode
buffer, and most of those commands should work already; e.g. I can press I
to clock in to an item, S-up
to change priority, C-c C-d
to set deadline, etc.
Other than that, Embark's Org Agenda support also works for org-ql-view
buffers and while using completion for org-ql-find
; e.g. I can C-. t
while using org-ql-find
to change an item's to-do status without having to visit it first.
ok just looks the issue is that I am a donkey. I was just that I was calling org-clock-in
instead of org-agenda-clock-in
etc.
Thanks again for your help, and sorry to bother you with this :)
close :)
No problem, it's an easy mistake to make, one I've made myself.