Setting a fallback action of org-ql-find
Hello,
Thank you for adding org-ql-find. It is super useful, and I have been using it daily since it has been added into master.
It would be nice if the function had accepted another argument that should be called on a non-matching candidate. For example, it could be used to allow the user to create a new task with a given title using org-capture if it does not exist in the file.
Another possible way to achieve a similar effect would be integration with embark. At present, no category is set in the command, but it would be better if we could customize the actions.
Hi Akira,
Thanks, I'm glad to hear that it's been useful.
That's an interesting idea. I agree that integrating it with Embark would be great. I haven't looked into how the completion candidate categories work; can we define one of our own, or do we have to use a standard one, or...?
You can define your own category. project--file-completion-table is an example of "completion table" function with custom category. I have defined several functions like this for using with embark.
"Programmed Completion" section in the info manual describes the details.
I implemented the fallback action in #290.
I also tried to implement the embark integration. It was easy to set a category, but the command would receive an OLP as an argument, which is not very useful.
An actual embark integration would require a transformer (which should be added to embark-transformer-alist), which could complicate the code a bit.
I don't think this is a good idea any more. I agree with your point in #299, and I ended up writing a small package for my own use case. I will close this issue. If you are interested, please feel free to reopen it.