emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Rick Lupton <mail@ricklupton.name>
Cc: "Y. E." <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Allow external libraries (org-roam) to supply org-id locations
Date: Wed, 20 Mar 2024 10:30:48 +0000	[thread overview]
Message-ID: <87jzlxjiuf.fsf@localhost> (raw)
In-Reply-To: <253384f1-503f-4417-a060-74aac5b97090@app.fastmail.com>

"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	other threads:[~2024-03-20 10:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 23:18 [PATCH] Allow external libraries (org-roam) to supply org-id locations Rick Lupton
2024-03-13 12:30 ` Ihor Radchenko
2024-03-16 22:46   ` Rick Lupton
2024-03-17 10:17     ` Ihor Radchenko
2024-03-17 22:54       ` Rick Lupton
2024-03-20 10:30         ` Ihor Radchenko [this message]
2024-04-20 11:07           ` Ihor Radchenko
2024-05-02 13:23             ` Rick Lupton
2024-05-02 13:28               ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzlxjiuf.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@ricklupton.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).