Hi,
I have implemented filter functions with other org-roam functions (e.g. org-roam-node-find), but it seems there’s no ability to use a filter function with org-roam-refile. Is there an alternative method to achieve something similar?
It seems filtering the list of nodes to refile into could be useful.
One way might be to use advice-add like this perhaps?
Seems to work on my end.
You’d need to add your own filter function in place of my lambda function in +org-roam-node-read below.
One cautious note is that it changes the behavour of org-roam-node-read, which is widely used such as org-roam-node-find and org-roam-capture, etc. (advice-remove #'org-roam-node-read #'+org-roam-node-read) removes the advice to return to the original behaviour. Please understand how you can remove the advice before you try it.
unwind-protect is there to remove the advice even when you cancel the refile operation – this seems to work, but please test it thoroughly on your end…
Thanks Nobiot, I have tested this and it seems to work perfectly from what I can tell.
I have incorporated it into my setup.
I’ll continue to use it & post an update if I encounter any problems - for the benefit of anyone else who stumbles onto this.