From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kKtvMSsmZWIBYgEAbAwnHQ (envelope-from ) for ; Sun, 24 Apr 2022 12:27:55 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id WCSUMCsmZWKnJAAAG6o9tA (envelope-from ) for ; Sun, 24 Apr 2022 12:27:55 +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 30292E1C6 for ; Sun, 24 Apr 2022 12:27:55 +0200 (CEST) Received: from localhost ([::1]:47742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niZT8-0005WL-0T for larch@yhetil.org; Sun, 24 Apr 2022 06:27:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niZQW-0005W8-Gy for emacs-orgmode@gnu.org; Sun, 24 Apr 2022 06:25:12 -0400 Received: from mail-ve1eur01olkn0807.outbound.protection.outlook.com ([2a01:111:f400:fe1f::807]:23819 helo=EUR01-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niZQS-0002MG-OF for emacs-orgmode@gnu.org; Sun, 24 Apr 2022 06:25:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=McxBPBKvrlKq6g6Q95aMc9ghjeW2PO8jDNexym3f1OaiZyJEkfDqvaFkaOvba/R60uHnoWlcwzy/oNBdicFNBiclXSFc9qjOsaburAgocGXRYSJe/dJpDzKKJrTd/LnfwF8rzmYe7iMmO6SiAlarQ6fsUY0gW0GBlkPcwkoGpOMkKgwShN/Ah60MxVYvu2Hls/GVbp2GZOtbPB4ir3PRZFOowYi2iu8G/pdLbpMCqUouytRsWqMK9IievjJxf/NHkDoZlDIraXC3f968GHpigVZw830GbMnMO/PjQTkFzPspdcbUHwmAzebSs7JcKn6phRGlh0y4AKeuHty5//k3sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MtVdzDXKoBVGwyHDF1xb/R6lNOTnYvzQYMPqUkYyyms=; b=Wm99HyPwpn3amfZaZV743a5frg3+3bxu6tTcIDnbShhwuZvOK49gPa/bnlpA7WbAh1r8QeOiAy2exZtxtaooqI2PXkbBs7ClSqzFzOShGtSRSOoa/Oj2Ar6ZPTw4Oe3UxV8VpHH4YHQMARQ4Tw6FmkeaCAqIKqywQ+gXjhY/0uTPWJwORutK4GyrezF/mgNhoZNXlG3xFFUNgwUafn3hWyLft7eUdtP/8qbX/opIJb4Elfz4ri0Y2/Id2Vsv5HKFppIOyLEUlwl656WNEI0+2o68ZeRkU9UpwvuZSv62Tuu9xv1tUaiBVpbgApbCDXSTozHeqG5tx5IzaFWML8jA1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MtVdzDXKoBVGwyHDF1xb/R6lNOTnYvzQYMPqUkYyyms=; b=bZAo1nqcC5XSpHNeZCj5BKQKkm8RCZRnpdaTdYy0d22JqArPtbtvJ1NzpnzMkk8/5vRmwwa+bzPPvG/M0MsmkT3tNi+dV0dg9S9ZwsJySVaexfB3oHQNBlJ7EhVgSqeopEpTMwv1u1yoNj4rHwxa/A4vRNn3saL5Olc5Gau1wFmA6mQUfxn7aZM/87b7N9dJTJBQC9Yp7ukz+OxbbQ97cnmIFc2wSFpiPpreYl29RbM1d5d143H1d1/OnHbm8KbtVhhun1MDpwwlJtHXi65xjRFjNdaQ4p1GhQEkPz3pIfMi/8XPJemEWd/XFnCJHWS+dePAVPIKnzn9/J1s0t7V/w== Received: from PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) by DB9PR06MB8090.eurprd06.prod.outlook.com (2603:10a6:10:297::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Sun, 24 Apr 2022 10:20:02 +0000 Received: from PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::3d50:522e:f03c:6225]) by PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::3d50:522e:f03c:6225%7]) with mapi id 15.20.5186.020; Sun, 24 Apr 2022 10:20:02 +0000 References: <87y1zvlyj0.fsf@localhost> User-agent: mu4e 1.6.10; emacs 27.2 From: Ignacio Casso To: Ihor Radchenko 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: Sun, 24 Apr 2022 11:45:00 +0200 In-reply-to: <87y1zvlyj0.fsf@localhost> Message-ID: Content-Type: text/plain X-TMN: [AqLrttd9DPD8Aa8q6ObelpSHGxx2aX5g] X-ClientProxiedBy: PR2P264CA0048.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101:1::36) To PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) X-Microsoft-Original-Message-ID: <87tuaig4vn.fsf@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 73e92b87-999e-4339-7776-08da25dbfdcf X-MS-TrafficTypeDiagnostic: DB9PR06MB8090:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C14XZy/2Crwr3zD+75SekMrhr7uG8VeUOIZZNYIGbWH6OvRP0AyjdNsAX4Qs+xhFaUzfvLfqestuye4G1kll8TFYun6648YiTpTGa9NlzC5vd4ClR9+jYtHf+8XkyLdtjNB4k82/zcW9v/mRGL0YjV0kW68h/lEgsHhWHUPyS5mvOd54uegg9l3BJInm1IanCINtRtQh12sdkjjYLULasxnmljeyyWFULL7ZheuXP5dBs31GDMK8GEFqJ3pZFqkA3bx8EPQm/rHuLu+kX1s5VgIhWTTVGwI4duRANnR856jmEW02FcQvwTt6sv56XUTFKJA/42nZ2Lru1BSdoFINuW0uqvRiKfi0IYFDe9hZzA7g/DUojJioVuAJRMi8CUxPZNWH41JfuxP6WaAzMnsM/t0A/Cil1HgF+8usHmD2S6A6nHT5MWZpNFKJIdNxPPEfHX+Cvv1jEzB/7/ch0hmqbrePIjmnFdiAc7CkxiuhuuYn6UkKDU3mqLf980ijmRkQkHz5NCTFe5fYDd1dPhinPWx7heDkL5T8y7k1T6O+LOJhfFKzqMrJbcujfucorIGOxxELSaJK7lJlbZ3qtRGeJg3/g8TmBB5vRAoGPEnyJTVDfmMOxH/6qhhbJKsLMzZV X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?89mIQh+B6dSVP5ORiP5k76Rdc34ln9iXC2dGf4oEOlbHGdRk44sKuXbb6bAi?= =?us-ascii?Q?a1ERBx9zjHHPV99esefzZbu3BziAU9RpqH4QWDURIPqjpmYRnpsFJTulmlZ4?= =?us-ascii?Q?spJKY6Jp6zECHaPYf3v8Hraq7A9dfAF66e3kZsGW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dFH9gzUsrUN5YSpXpH/q9I/tio0XBZ9daKvyzQNdnDKIZgytja/4rwlc5?= =?us-ascii?Q?MJ21rxNikF8gssnNHRyvOQMlGamvTpCKStuw3dt2z7qeH6c6p7uDHlLsFWwp?= =?us-ascii?Q?LlLTdMvWigBxPVWYolQ6ZJVAOVA7xCaUbIbcNuRnkMRD19Pamlkrh7k5xcwl?= =?us-ascii?Q?KnevtlHnjG4SsiyE6dXdLcGbDEoF3UVOkC5EUljAzNFMNd8rvltIK4HVjGno?= =?us-ascii?Q?hOmJofYblGOqV6a1K8c85zD+zzbEG5mwuzgs5/2i0yuBaIfWNOa8W3s5oCKX?= =?us-ascii?Q?FGX5itcqrK0d1jnw94uBXbn9EZVM+8ABaOHZzDaksmLjEBuRD99wxuqVbxAb?= =?us-ascii?Q?YbpzHbwppRch/+7q7FzXLI4itka1Ki1jZ5oJ0f9HSO8MoPEST8bHsPxZXEcg?= =?us-ascii?Q?fs59ZsEW4og=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6e454.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 73e92b87-999e-4339-7776-08da25dbfdcf X-MS-Exchange-CrossTenant-AuthSource: PAXPR06MB7760.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2022 10:20:02.5780 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR06MB8090 Received-SPF: pass client-ip=2a01:111:f400:fe1f::807; envelope-from=ignaciocasso@hotmail.com; helo=EUR01-VE1-obe.outbound.protection.outlook.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, SPF_HELO_PASS=-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 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=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650796075; 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=MtVdzDXKoBVGwyHDF1xb/R6lNOTnYvzQYMPqUkYyyms=; b=kY7ffijXJAsxAoT2oGZu49kN8M9ZIDDLTvTTHgz/TNS3An/ixSwkFgM0y5nXDbdnNy3NDM tYSqj6CrBUa1xe36B8spSspPsvk/LGtsC9vGIylHNjiIDHJv1sX6snP9S7isWQ7rQLXI05 94AT2o4lyLTJvc2HL0t2qwENorr7LybNJmdwH+QoNBhdq+3HvdsIK+48a/cWj9BqqYiieG wKv3AKJZpt+CjNQ9KVCskct6Y2OygsdVu5xutkMz3TDwX/P12nfB4dMP4wkiBkMIHDzRqv iAElMLTo/UaZL2cU23q3Pzz2+Mki+NXYxTaJwW7VDJ8psCqMqhFiI0l5uIZKOg== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1650796075; a=rsa-sha256; cv=pass; b=MUPzD01lvG78TwCGEFfAKNivYtzZxPcNuuBTfo+7PR/DkbXdXk8y8hK6Grot1Di3SZ3UPm msVLOGg+nzeXj4653PABFOlE8k+W8i8rEpBm1xRfZc6X3P3Y4iO/iPK9YYneM6NJVRQDFd eVx8UkqW0PAdRFk5OJp71eUpMmFLYsq3yjwYeNYJDbq3E2BXL4AQtqTw09361dj+PiFGT+ BZCohHpvbHk0aIDMmEPkDJbAI/lULRTnPlSahTiAKIJe0kweUuwNPRr2VHyHozku9HxOvE MtOhH0Q8g/SboUbANuWUKD38tb62ZBL+i9aGKLPAn6wLhTAHQ8yq/1wTSjaTMw== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=bZAo1nqc; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.com; 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: -5.02 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=bZAo1nqc; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.com; 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: 30292E1C6 X-Spam-Score: -5.02 X-Migadu-Scanner: scn1.migadu.com X-TUID: DqOXSBvxdWpe Ihor Radchenko writes: > Ignacio Casso writes: > >> Link abbreviations do not work inside property drawers and are instead >> confused with internal links. The following org file illustrates this >> behavior. > > This is to be expected. org-open-at-point does the following: > > ;; No valid link at point. For convenience, look if something > ;; looks like a link under point in some specific places. > ((memq type '(comment comment-block node-property keyword)) > (call-interactively #'org-open-at-point-global)) > > That is, links are only partially recognised inside comments, node > properties, and keywords. > >> I know that there is discussion of whether timestamps and links should >> work or not inside property drawers, but since they currently work, I >> think link abbreviations should be supported too. Let me know if you >> agree and I'll debug the issue and send a patch with a fix proposal. > > I do not think that it is an easy problem to solve properly. > > In the discussion you referenced [1] Nicolas raised the problem that we > cannot modify org-element parser to support links in more contexts as it > may create various issues (e.g. in exporter). > > Without modifying the parser, supporting abbreviations will require code > duplication or referring to internal org-element functions - a fragile > approach. > > I am currently tinkering with an idea to implement several parser > contexts, similar to optional argument in org-at-timestamp-p. > Basically, org-element parser could allow using multiple > named org-element-object-restrictions: 'agenda, 'export, 'lax, etc. > This is not ideal, as Org syntax will be more complex. However, multiple > interpretations of Org syntax are already implemented de facto (e.g. > org-at-timestamp-p). So, centralising the parsing into org-element could > be beneficial. > > Probably, the contexts might be defined by let-bound > org-element-parser-context value. > > Best, > Ihor > > [1] https://orgmode.org/list/877d8llha9.fsf@nicolasgoaziou.fr Actually, I have investigated a little bit and I think the issue is more simple than that: - Link abbreviations rely in the variables `org-link-abbrev-alist' for global abbreviations and `org-link-abbrev-alist-local' for abbreviations defined with #+LINK for a single org file. - `org-open-at-point-global' opens links with `org-link-open-from-string' as opposed to `org-open-at-point', which uses `org-link-open'. - `org-link-open-from-string' ends up using `org-link-open' too, but inside a `with-temp-buffer' form: (defun org-link-open-from-string (s &optional arg) ... (pcase (with-temp-buffer (let ((org-inhibit-startup nil)) (insert s) (org-mode) (goto-char (point-min)) (org-element-link-parser))) (`nil (user-error "No valid link in %S" s)) (link (org-link-open link arg)))) - But in a temporal buffer, `org-link-abbrev-alist-local' is nil, and thus all abbreviations defined with #+LINK are lost. So a simple solution to this would be preserving the value of `org-link-abbrev-alist-local' when switching to the temporal buffer. I think this is orthogonal to the issue of the parser, and it's a bug on its own, since as a user I would expect that evaluating `org-link-open-from-string' would use my current buffer's local values of variables. What do you think? If you agree, I can send a patch fixing it in two lines with something like this: (let ((org-link-abbrev-alist (append org-link-abbrev-alist org-link-abbrev-alist-local))) (pcase (with-temp-buffer ...) ...)) or this: (let ((tmp-var (org-link-abbrev-alist-local))) (pcase (with-temp-buffer (setq org-link-abbrev-alist-local tmp-var) ...) ...)) P.S. There is another variable defined with `defvar-local' in ol.el: `org-target-link-regexp'. I don't know what it is used for but it could potentially suffer from the same problem.