From: Ihor Radchenko <yantar92@gmail.com>
To: Harald Judt <h.judt@gmx.at>
Cc: emacs-orgmode@gnu.org
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 [thread overview]
Message-ID: <877depxyo9.fsf@localhost> (raw)
In-Reply-To: <97c31832-9dce-c52f-038e-ccc80157b62e@gmx.at>
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
next prev parent reply other threads:[~2021-10-07 4:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-06 9:44 [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/)] Harald Judt
2021-10-07 4:10 ` Ihor Radchenko [this message]
2021-10-08 11:38 ` Harald Judt
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=877depxyo9.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=h.judt@gmx.at \
/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).