From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id uB7mKesilF4QCAAA0tVLHw (envelope-from ) for ; Mon, 13 Apr 2020 08:29:31 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id WKydCO4ilF6eBwAA1q6Kng (envelope-from ) for ; Mon, 13 Apr 2020 08:29:34 +0000 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 aspmx2.migadu.com (Postfix) with ESMTPS id 5D27868230B for ; Mon, 13 Apr 2020 08:29:31 +0000 (UTC) Received: from localhost ([::1]:41596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNuTB-0007UN-Iu for larch@yhetil.org; Mon, 13 Apr 2020 04:29:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41985) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNuRY-0007Sl-DZ for emacs-orgmode@gnu.org; Mon, 13 Apr 2020 04:27:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNuRW-0005xB-UX for emacs-orgmode@gnu.org; Mon, 13 Apr 2020 04:27:47 -0400 Received: from mx1.polytechnique.org ([129.104.30.34]:55248) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jNuRW-0005ug-P7 for emacs-orgmode@gnu.org; Mon, 13 Apr 2020 04:27:46 -0400 Received: from set (cbg35-2-78-242-14-140.fbx.proxad.net [78.242.14.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id B508556127C for ; Mon, 13 Apr 2020 10:27:42 +0200 (CEST) From: Alan Schmitt To: "emacs-orgmode" Subject: links are not parsed in keyword context Date: Mon, 13 Apr 2020 10:27:34 +0200 Message-ID: <87r1wr23k9.fsf@polytechnique.org> MIME-Version: 1.0 Content-Type: text/plain X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Mon Apr 13 10:27:43 2020 +0200 (CEST)) X-Org-Mail: alan.schmitt.1995@polytechnique.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 129.104.30.34 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 X-Spam-Score: -1.01 Authentication-Results: aspmx2.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx2.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [-1.01 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.57732911912504]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.28), country: US(-0.01), ip: 209.51.188.17(-0.58)]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; FROM_NEQ_ENVFROM(0.00)[alan.schmitt@polytechnique.org,emacs-orgmode-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; DMARC_NA(0.00)[polytechnique.org]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; R_DKIM_NA(0.00)[]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: Ngpib1Z38GYh Hello, If you consider the following line in an org file #+begin_src org #+FOO: http://alan.petitepomme.net/ #+end_src then calling ~org-element-context~ returns #+begin_src emacs-lisp (keyword (:key "FOO" :value "http://alan.petitepomme.net/" :begin 1 :end 38 :post-blank 1 :post-affiliated 1 :parent nil)) #+end_src If the same link is in the body of the org file, one gets #+begin_src emacs-lisp (link (:type "http" :path "//alan.petitepomme.net/" :format plain :raw-link "http://alan.petitepomme.net/" :application nil :search-option nil :begin 38 :end 66 :contents-begin nil :contents-end nil :post-blank 0 :parent (paragraph (:begin 38 :end 68 :contents-begin 38 :contents-end 67 :post-blank 1 :post-affiliated 38 :parent nil)))) #+end_src The link can still be opened in both cases using ~org-open-at-point~, but it is a problem for org-ref that relies on the second format to extract the link information (see https://github.com/jkitchin/org-ref/blob/master/org-ref-core.el#L2045, where the link is set to ~nil~ because there is no ~:path~ property). I see that orgmode uses a workaround in ~org-return~ when ~org-return-follows-link~ is set to true, to detect if there is a link using a regexp (https://code.orgmode.org/bzg/org-mode/src/maint/lisp/org.el#L18106): #+begin_src emacs-link ((and org-return-follows-link (or (org-in-regexp org-ts-regexp-both nil t) (org-in-regexp org-tsr-regexp-both nil t) (org-in-regexp org-any-link-re nil t))) (call-interactively #'org-open-at-point)) #+end_src Could is be possible to parse a link in keyword context? Alternatively, should I suggest org-ref uses an approach similar to the one in ~org-return~? Thanks, Alan