From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aAsRF+sKaWJTbwAAbAwnHQ (envelope-from ) for ; Wed, 27 Apr 2022 11:20:43 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id qF1NFusKaWJRIgEAG6o9tA (envelope-from ) for ; Wed, 27 Apr 2022 11:20:43 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EC67D3B656 for ; Wed, 27 Apr 2022 11:20:42 +0200 (CEST) Received: from localhost ([::1]:34504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njdqj-00045m-WC for larch@yhetil.org; Wed, 27 Apr 2022 05:20:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njdou-000438-2S for emacs-orgmode@gnu.org; Wed, 27 Apr 2022 05:18:48 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:43944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njdos-0004xL-3c for emacs-orgmode@gnu.org; Wed, 27 Apr 2022 05:18:47 -0400 Received: by mail-lf1-x12a.google.com with SMTP id x17so2011193lfa.10 for ; Wed, 27 Apr 2022 02:18:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vg+Jyvx5M/ezbjIR27trZxWDNs5zNYwDeA5/SalJCvs=; b=h4gd9Zds/a4DBgYEAnbROwyQM1Imz8wjDP1IV2Qi4WlLACS4Oaa6pLJnSGKx6O4p2z pDlmOYL0VM6KkJtR8Qi/Etr7TyBea5AzaRwJPInOXOj2njYIzyMzaW4xE/s60mQeRQzK EQfqHsOx69U/f81b/uDwYPmQOm23w5RvmNNc6mFC6ws0p32oetNMI0VD3O42gH+rtYY8 c6iy6jIlRyFzYFAws57N8o9VfTTUm4hZfYXVzbbAZCKpTWfO8wkD+/oSMSflh50czEy3 /WqtCNDXS+VI3qPap/EcCExi/d4pkx5/lvfcxA2LNP+ClYcmryQ7vjFLn3/bi+ZXThU0 Jwzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vg+Jyvx5M/ezbjIR27trZxWDNs5zNYwDeA5/SalJCvs=; b=vATvKW4BQbhDWvbyFvJibl/VVZVpaEQukK4GS9wDx4NK3MA7R/4MXeC15OKfrrmvGn w43rzi/7/R2EsDnQuQKo6/T16Y6hMJNMRZA2hNX81oGRUJQ/yOOsSywwgSLqrH7nykdp sDh9OHo8SoR6pGcFSwdZNV/WRdtnry6qr4CY6C2q+hNp84EcDtVnBzEhqlKliNDYnRjN ral3d1KnD5VFc0ExloYwdIDErIg90UYCpOAzB2okiCKWt+q/tdKT3JpfpGbttuKMhBul b/+5USXtqPXGadQ528syXwrNwKKeih2WwAyB3h3D5kycIpC5rFEA+3O1+m6FNDZUjEN2 IPZw== X-Gm-Message-State: AOAM5322OOCvW7X+us/1ARP6NV+Ea7kKLDIInIe7182pkNaGHoIx5I5m yUiTq1FStON6Acooqz3XyjoFOmcbDpPjxnvVFu8= X-Google-Smtp-Source: ABdhPJwDjtCKH26J9RGDEaUW+uPptOTTzBmUbsssXEmlo9gACtUR5VXxyImEXswPjIJt4/f+EgTq7YUx67fn0AZqsIE= X-Received: by 2002:ac2:4c46:0:b0:472:23f6:a3d8 with SMTP id o6-20020ac24c46000000b0047223f6a3d8mr3263151lfk.203.1651051123260; Wed, 27 Apr 2022 02:18:43 -0700 (PDT) MIME-Version: 1.0 References: <87y1zvlyj0.fsf@localhost> <878rrsut3o.fsf@localhost> <8735i0vtn7.fsf@localhost> <87wnfbup8x.fsf@localhost> In-Reply-To: From: tony aldon Date: Wed, 27 Apr 2022 11:18:32 +0200 Message-ID: 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/)] To: Ignacio Casso Content-Type: multipart/alternative; boundary="000000000000b5417505dd9f4bfb" Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=tony.aldon.adm@gmail.com; helo=mail-lf1-x12a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org, Ihor Radchenko Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651051243; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vg+Jyvx5M/ezbjIR27trZxWDNs5zNYwDeA5/SalJCvs=; b=TZF48+9XOyle1qt9kNCYNIflKoWuVTmBSRf1sZ3CVHasUFyiGDj5mxMtuW2O0au0OBWL0J 7pHs7lMAHZz3ktuxIhe+ru/+0v+6MtvyZG655CsJGqz6iz1rsW/D3mFe+2p1SGlWw4e+gF JMz7DfAf6phnYWfhtrVnnpGNHc+U1e44voGOpVTUkSRkmxOQAz48lPm5F06AOgFpRtyQYk MMYxAwf7uktTvZidnkNUiUiffJkX9jYtrIDgLQUlBU5vaprrKT86RwjO4TvdtSAGgKorMU IZxLu8nz+MCsaRkOeeJPdTZGjv/4IURQcT9WSxbBl/ZJJKlMA8JpjuN86X9oEg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651051243; a=rsa-sha256; cv=none; b=XjwmiXwV2UOZ8NiL2ti2lwUCQSsP7BT/smk9tWhVQgfWYMn3/uNOc/00aIWN8pitQDOlKm W5VyEuraUVbmgu8JQmShVrqSmjYHkWQR0aCBWfyXoLstFjFurAJiv0VszEfrvM4d8c6wrB 77zE5x1bGfLntWfI24/SRHK+tuxT3+gslEA0m2aCOgTuGZPoTygvrwp8ceBfi51kvQZ+Y8 m10cOyNI0n3CQcE8YObcPXWAxM4GbqLF4yum/4pRstprYdn/PM7LrLGzoWYG7ACw1dOfy8 wpZtWNbJtvdxVB+gvuy06c6p/pZCtcjDktKOgX1t+qJExMB8BLojBTBkemrfzg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=h4gd9Zds; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 6.19 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=h4gd9Zds; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: EC67D3B656 X-Spam-Score: 6.19 X-Migadu-Scanner: scn1.migadu.com X-TUID: j20X0DZWnL0p --000000000000b5417505dd9f4bfb Content-Type: text/plain; charset="UTF-8" I quietly followed the conversation. Thank you for the advice. On Wed, Apr 27, 2022 at 9:06 AM Ignacio Casso wrote: > > Ihor Radchenko writes: > > > Ignacio Casso 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 > > --000000000000b5417505dd9f4bfb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I quietly followed the conversation.=C2=A0 Thank you for t= he 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 ()
>>=C2=A0 =C2=A0 =C2=A0...
>>=C2=A0 =C2=A0 =C2=A0(cond ((org-in-regexp org-link-any-re)
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-link-open-from-string
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-link-expand-ab= brev (match-string-no-properties 0))))
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0...))
>>
>> 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 cha= nge
>> `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 an= d
> 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 firs= t
reply apply: doing it inside `org-open-at-point' would duplicate a lot<= br> 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)
=C2=A0 (let ((org-link-abbrev-alist
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(append org-link-abbrev-alist org-link-ab= brev-alist-local)))
=C2=A0 =C2=A0 (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

--000000000000b5417505dd9f4bfb--