org-rifle
org-rifle copied to clipboard
Opting out of v1.5.0 TODO keyword special handling
I'd like to use helm-org-rifle the way that it appears to have worked prior to v1.5.0, where searching for TODO keywords matched against entry text as well as heading text. My use case is the "TODO" keyword; in my notes I write TODO a lot inline when I want to elaborate on a specific point and don't want to clutter the entire headline with the TODO state (thinking about it now that's not too bad of a tradeoff, but I still think this functionality would be nice as an option). After looking through a few alternative packages, I didn't find any others which had the same contextual output, primarily the outline path of each match. After looking through the code a bit, I thought that I could potentially achieve my desired behavior by advising the --parse-input
function so that all TODO keywords would go into the includes
field rather than being placed into the todo-keywords
field, like so:
(defadvice! srithon/helm-org-rifle--parse-input-match-todo-keywords (return-list)
"Takes TODO keywords field and adds it to the regular INCLUDES"
:filter-return #'helm-org-rifle--parse-input
(cl-destructuring-bind (includes excludes include-tags exclude-tags todo-keywords)
return-list
(list (append includes todo-keywords) excludes include-tags exclude-tags nil)))
However, this didn't work because it seems that the INCLUDES are now ignoring the TODO states altogether. Is there any simple way to achieve this behavior in the current version of org-rifle?
What if you just type in todo
instead of capitalizing it?
Unfortunately, typing in lowercase "todo" didn't match against the TODO states of headings on my setup. More specifically, "todo" would match "todo" and "TODO" within entry text, while "TODO" would match headlines with the corresponding TODO state. I apologize if this is an issue with the rest of my configuration; when I get some more time I can try using a minimal config.
No need to apologize. I think it's just a consequence of using the "smart" query processing. Here's what I'd recommend, in order of preference:
- See if you can use
helm-org-ql
or otherorg-ql
commands to meet your needs. If their display format doesn't suit you, maybe we can fix that. org-ql is a more flexible, powerful, and future-oriented library, and it's generally preferable to spend time on improving it than on org-rifle. - Make a minor patch to the code to adjust the argument handling (i.e. rather than using advice), and use it in your own config.
- Write a patch to add an option to the argument handling code to always include to-do keywords in the main query tokens. Then submit it here and, once ready, it can be merged, and then you can use the new version including it.
After going over your options a bit, I figured that option 3 was the easiest for me to do. Also, since this behavior used to be part of the package, I thought it was reasonable to add it back here instead of patching org-ql, which from what I understand is far more complex. I just made a PR adding in an option for matching against TODO keywords. In my testing, it seems to be working as expected, but if I'm missing something please let me know.