emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [BUG] org-context called from link in org-agenda entry returns wrong


From: Ihor Radchenko
Subject: Re: [BUG] org-context called from link in org-agenda entry returns wrong values [9.5 (9.5-g0a86ad @ /home/.emacs.d/elpa/org-9.5/)]
Date: Thu, 07 Oct 2021 12:10:30 +0800

Harald Judt <h.judt@gmx.at> writes:

> Hi,
>
> I am using this function to copy links from the agenda to the clipboard:
>
> (defun my-copy-org-url ()
>      (interactive)
>      (let* ((link-info (assoc :link (org-context)))
> ...

org-context is ancient. It relies on org-links being fontified using
'org-link face and would fail for any non-standard link with :face link
parameter. Moreover, the return value will be different depending on
org-link-descriptive setting.

We should probably deprecate this function and encourage using
org-element-context. So, I recommend rewriting your code with
org-element-context.

> This indeed worked fine with previous versions of org, but recently started
> to fail to extract the link. Example entry to put into your agenda
> to test this:
>
> * TODO Header with [[https://orgmode.org/][Link]]
> SCHEDULED: <2021-10-06 Mi 12:00>
>
> Now the function above should extract "https://orgmode.org/";, but
> instead the text extracted is "Lin".

It seems that some of the faces were not applied together, making
next-single-property change stop early because faces are not 'eq (though
'equal). Not sure if we really need to do anything about it. It is a bad
idea to rely on next/prev-property-change in org-context anyway.

Best,
Ihor



reply via email to

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