From: tony aldon <tony.aldon.adm@gmail.com>
To: Ignacio Casso <ignaciocasso@hotmail.com>
Cc: emacs-orgmode@gnu.org, Ihor Radchenko <yantar92@gmail.com>
Subject: Re: [BUG] link abbreviations do not work inside property drawers [9.5.2 (release_9.5.2-38-g682ccd @ /home/ignacio/repos/emacs/lisp/org/)]
Date: Wed, 27 Apr 2022 11:18:32 +0200 [thread overview]
Message-ID: <CACWitSD=fr4zE+H5QzEY0PGp-Fxf+MFSv12Z02VL2axOsWLmWg@mail.gmail.com> (raw)
In-Reply-To: <PAXPR06MB7760CE05D2326E8A853E885DC6FA9@PAXPR06MB7760.eurprd06.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 2368 bytes --]
I quietly followed the conversation. Thank you for the advice.
On Wed, Apr 27, 2022 at 9:06 AM Ignacio Casso <ignaciocasso@hotmail.com>
wrote:
>
> Ihor Radchenko <yantar92@gmail.com> writes:
>
> > Ignacio Casso <ignaciocasso@hotmail.com> writes:
> >
> >>> A better approach could be using org-link-expand-abbrev. It is an API
> >>> function and should be forward-compatible.
> >>
> >> Do you mean something like this?
> >>
> >> (defun org-open-at-point-global ()
> >> ...
> >> (cond ((org-in-regexp org-link-any-re)
> >> (org-link-open-from-string
> >> (org-link-expand-abbrev (match-string-no-properties 0))))
> >> ...))
> >>
> >> Right now that is not enough because `org-link-expand-abbrev' only works
> >> for links without square brackets, like "abbrev:suffix", and
> >> `org-link-any-re' matches links with square brackets, like
> >> "[[abbrev:suffix]]". That could be easily worked around in
> >> `org-open-at-point-global' but maybe it would be better to change
> >> `org-link-expand-abbrev' to work with both forms.
> >
> > Fair point. Then, the most future-proof way would be calling
> > org-element-link-parser. It should take care about abbrev expansion and
> > other edge cases. Then, you just need to use :raw-link property of the
> > parsed link element.
> >
> > Best,
> > Ihor
>
> And then we come full circle, since that is what is being done already
> but in a temporal buffer (so without access to
> `org-link-abbrev-alist-local'), and your original concerns in your first
> reply apply: doing it inside `org-open-at-point' would duplicate a lot
> of code.
>
> So I guess the issue is not as orthogonal as I though with the one of
> the parser and it would be complicated to fix it properly, as you said
> in your first email. If no one else has reported this problem or replied
> to this thread, I guess that probably the best thing to do is fixing
> this in my own config and move on for now:
>
> I'll copy here the advice that fixes it, in case anyone needs to add it
> to their config too:
>
> (defun my-advice (orig-fun &rest args)
> (let ((org-link-abbrev-alist
> (append org-link-abbrev-alist org-link-abbrev-alist-local)))
> (apply orig-fun args)))
>
> (advice-add 'org-open-at-point-global :around 'my-advice)
>
> Best regards, and thanks for taking a look at this,
>
> --Ignacio
>
>
[-- Attachment #2: Type: text/html, Size: 3205 bytes --]
prev parent reply other threads:[~2022-04-27 9:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-23 9:53 [BUG] link abbreviations do not work inside property drawers [9.5.2 (release_9.5.2-38-g682ccd @ /home/ignacio/repos/emacs/lisp/org/)] Ignacio Casso
2022-04-24 7:40 ` Ihor Radchenko
2022-04-24 9:45 ` Ignacio Casso
2022-04-26 8:49 ` Ihor Radchenko
2022-04-26 9:07 ` Ignacio Casso
2022-04-26 13:52 ` Ihor Radchenko
2022-04-26 14:46 ` Ignacio Casso
2022-04-27 4:25 ` Ihor Radchenko
2022-04-27 6:46 ` Ignacio Casso
2022-04-27 9:18 ` tony aldon [this message]
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='CACWitSD=fr4zE+H5QzEY0PGp-Fxf+MFSv12Z02VL2axOsWLmWg@mail.gmail.com' \
--to=tony.aldon.adm@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=ignaciocasso@hotmail.com \
--cc=yantar92@gmail.com \
/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).