"Rick Lupton" <m...@ricklupton.name> writes: > Since updating the org-id code [1] to use the standard org-link registered > functions instead of hard-coding org-id opening, I have a problem using > org-roam. > > org-roam overwrites the :follow function for "id" links from the build-in > `org-id-open' to its own `org-roam-id-open' > (https://github.com/org-roam/org-roam/blob/8667e441876cd2583fbf7282a65796ea149f0e5f/org-roam-id.el#L91). > The only change between these functions is to insert a call to try > `org-roam-id-find' before trying `org-id-find', which uses org-roam's cached > sqlite database to find the id > (https://github.com/org-roam/org-roam/blob/8667e441876cd2583fbf7282a65796ea149f0e5f/org-roam-id.el#L70-L71) > > As well as being messy, my specific problem is that the improvements to open > search strings in org-id links are no longer enabled when org-roam is loaded. > > It seems reasonable that a library might want to provide its own way of > locating org-ids. The attached patch adds a new hook variable > `org-id-find-functions` which contains functions doing the same job as > `org-id-find' that should be tried first. Then all org-roam needs to do is > add its `org-roam-id-find' to the hook. > > Does this seem like a good idea?
I think that we can do it simpler. Something like (defun yant/message-me (&rest _) (message "I am here!") nil) ; return nil to pass the turn (gv-define-setter org-link-get-parameter (value type key) `(org-link-set-parameters ,type ,key ,value)) (add-function :before-until (org-link-get-parameter "id" :follow) #'yant/message-me) The idea is to use Emacs' advice machinery to allow third-party code alter the functions stored in link parameters. Either way, org-roam needs to be adapted in order to support the changes in org-id. My variant appears to be simpler. We just need to add `gv-define-setter ...' and maybe also document the `add-function' approach in the manual. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>