Christian Barthel <[email protected]> writes:

> On Saturday, October 11, 2025, Ihor Radchenko wrote:
>
> [..]
>> Please, do not touch org-store-link. All the ID property handling is in
>> org-id.el.
>
> Hm - I tried to set a breakpoint to see when
> ‘org-link-precise-link-target’ is actually being executed.  And
> with the current ol.el on my disk (Emacs 30.1.90), it only gets
> executed when CUSTOM_ID is set.  It happens in the below snippet
> where the CUSTOM_ID property is checked:
>
> --8<---------------cut here---------------start------------->8---
> ;; org-store-link:
> ;; 
> https://cgit.git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ol.el#n2570
> ...
>         (when (and (buffer-file-name (buffer-base-buffer))
>                    (derived-mode-p 'org-mode)
>                    (org-entry-get nil "CUSTOM_ID"))
> --8<---------------cut here---------------end--------------->8---

That's an additional link stored beside the main link.
You likely have `org-id-link-to-org-use-id' set to nil (the default),
which prevents Org from creating id links.

>> In your case, you need to extend
>> ...
>> to check when point is at dedicated target and, when yes, return target
>> name as search string. Like what is done for NAME, but you will need to
>> use org-element-context to check whether there is target at point.
>
> Sorry - I am not that deep into elisp to provide a better patch
> right now.

This should actually be fairly simple.
You need org-element-context, org-element-type-p, and org-element-property
(see https://orgmode.org/worg/dev/org-element-api.html#org682dd2a).
It will be just an additional cond clause.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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