emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Allow external libraries (org-roam) to supply org-id locatio


From: Ihor Radchenko
Subject: Re: [PATCH] Allow external libraries (org-roam) to supply org-id locations
Date: Wed, 20 Mar 2024 10:30:48 +0000

"Rick Lupton" <mail@ricklupton.name> writes:

> The point is that I was thinking org-roam should advise/modify/hook the 
> specific function `org-id-find' [to find ids in its database] but NOT the 
> more general `(org-link-get-parameter "id" :follow)' [because `org-id-open' 
> has a lot of extra logic for search-strings, backwards compatibility, where 
> to open the new location, which it would not be reasonable to duplicate].
>
> Is there a way to do this using the approach you are suggesting?

No. Then, your patch makes sense.

> +(ert-deftest test-org-link/org-id-find ()
> +  "Test `org-id-find' specifications."
> +  (should
> +   (equal '("id.org" . 12)
> +          (org-test-with-temp-text ""
> +            (add-hook 'org-id-find-functions (lambda (id _markerp) (cons 
> (concat id ".org") 12)) nil t)
> +            (org-id-find "id")))))

... although this test does not look right. You are modifying the hook
by side effect, retaining the value for all other tests.

Please remove the hook after calling ~org-id-find~ via ~unwind-protect~.

Also, before we merge your patch, may I know if you discussed this
change with org-roam developers? If they do not want to use the proposed
hook, there is no reason to add it to Org mode.

-- 
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>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]