org-clock-convenience
org-clock-convenience copied to clipboard
org-clock-convenience-clocked-agenda-re is not robust to changes in org-agenda-prefix-format
This is a continuation of https://github.com/dfeich/org-clock-convenience/issues/9#issuecomment-704708405
First of all, thanks for building this package---it really is such a convenience for org-clock.
I've noticed that sometimes, the package doesn't work on particular lines in my agenda---the culprit turns out to be that the line format is different from what org-clock-convenience-clocked-agenda-re
expects.
Digging deeper, I realized it's because i've set the following variable:
(setq org-agenda-prefix-format '((agenda . " %i %-12:c%?-12t%-6e% s")
(todo . " %i %-12:c %-6e")
(tags . " %i %-12:c")
(search . " %i %-12:c")))
(the agenda
item is the one that really matters here).
It'd be nice if there was some way to make org-clock-convenience-clocked-agenda-re
more robust to custom settings of org-agenda-prefix-format
, or at least document that only particular values of org-agenda-prefix-format
work well.
For the meanwhile, though, I'm happy to just remove / override this configuration line. I use org-agenda-custom-commands
, so I can override org-agenda-prefix-format
on a section-by-section basis (note the first block doesn't display the effort, while the third does).
(setq org-agenda-custom-commands
'(("c" "Day planner with To-Dos"
((agenda ""
((org-agenda-span 'day)
(org-deadline-warning-days 365)
(org-agenda-prefix-format " %i %-12:c%?-12t% s")
))
(alltodo ""
((org-agenda-overriding-header "To Refile")
(org-agenda-files '("~/git/gtd/inbox.org"))))
(alltodo ""
((org-agenda-overriding-header "Next actions")
(org-agenda-skip-function #'org-agenda-skip-all-siblings-but-first)
(org-agenda-prefix-format "%-32:(org-agenda-format-parent 30) %?-12t%-6e")
))
nil))
))
I think your current workaround of showing the information in different blocks (or could even be different views as different agenda custom views) is nice. Getting org-clock-convenience to automatically adapt to the settings in org-agenda-prefix-format
would be quite a high effort, so I would not like to go that way. If really needed, a user can adapt the existing regexps and matching field name lists to fit his configuration, but it will require some advanced emacs regexp skills.
I am using generic functions to find, read out, or place the cursor in named fields. These functions always take among the arguments a regexp defining all the fields, and a list of field names. As an example, this call places point (the cursor) at the field "d1-time" that is defined by the regexp org-clock-convenience-clocked-agenda-re
and the list of field names in org-clock-convenience-clocked-agenda-fields
.
(org-clock-convenience-goto-re-field 'd1-time
org-clock-convenience-clocked-agenda-re
org-clock-convenience-clocked-agenda-fields)
So, one just needs to modify those two variables.
The best way for me in Emacs to play with regexps and getting the escaping right is to use Emacs' regexp-builder
mode.
I need to add some documentation for users to make them aware of these problems. Thank you again for reporting.
Closing this old bug. The solution to problems with customized org-agenda-prefix-format
are documented in the README file under the heading Dealing with changes in org-agenda-prefix-format.