From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id EHJCJ7Ria2QQBAAASxT56A (envelope-from ) for ; Mon, 22 May 2023 14:40:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id uKLiJrRia2SBKAAAauVa8A (envelope-from ) for ; Mon, 22 May 2023 14:40:20 +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 4A5A02FFDF for ; Mon, 22 May 2023 14:40:20 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q14ox-00039u-VA; Mon, 22 May 2023 08:39:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q14ou-000374-TI for emacs-orgmode@gnu.org; Mon, 22 May 2023 08:39:25 -0400 Received: from mail-oa1-x34.google.com ([2001:4860:4864:20::34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q14ot-0000Vm-6n for emacs-orgmode@gnu.org; Mon, 22 May 2023 08:39:24 -0400 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-19a19778b09so2470639fac.3 for ; Mon, 22 May 2023 05:39:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684759160; x=1687351160; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=uRtJRqaiaML4ujKuJw5yvYjqkDEullD8lJqBzFfMmx0=; b=cEO81X2yjOoyESpnyiYFI7UyDyrSm2HTXE3/4xhHhlCNwIfbqdo8HulwhuAgYXdDf3 58lDB6VqhqwYdUCQa+gmIKekdwCS+7IQkgOFmB0jEVYKyfmPtph8jvOTb+R0fVu2fZlC BHT+l46iy6A2FuAq7gviuXeUw3MhXwwBNE6o8ID/J3E21OpGIPLXixIfMbkRWlVEFsIv i7s78ei5k+uMQDGzuNdWG1aFO+i/qVSgODG1AzWaNjs+nxVksL8lB+iKKUm2aIyiFo28 l/ZQhNOK7wWWt+nLrwGHX9CCfSM7lRzCqMmdKABg4dCNzj0H0XRUK9t6Yz2nXQFzypDC LS/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684759160; x=1687351160; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uRtJRqaiaML4ujKuJw5yvYjqkDEullD8lJqBzFfMmx0=; b=PfsdZ18xkcfmMvZnb7PJYtGKl7HZmbk9A3O1DCF3BoZd9JNpRfckF9dBjR8p0lzdFe 9NMDvJkepTvRYHUyfc5QIv+Z2cLtAXmMSvnEa9oTRuQkyzH7+8KABtVY2uLvVcpw/q/A dD7QTs2qvVzbVqBRanNYRISXkahLV+w9dD/pA/QloWwJdfIZygwVo2eEsp6VBwPzKVck ZQEQXYQiYOBrNWJdABlRll9kdcfqdxLwz5hO427YQqcDf4FwWLGU9jddQMrKgpne1G0d vEfO3adVkFZpSlXLNDlsBLqbUewa+qmFkOsheuNVrMQxK5HMvDfaQXKakjZ018b+YK74 Q6HA== X-Gm-Message-State: AC+VfDxxsxLD/y7NBzs7sLleNeWf1fXMLRZz14PAMPmOa3l9poUJWvLt F1awoiPSHYUBq0PHfWRS3w50aAzNTiY= X-Google-Smtp-Source: ACHHUZ6x9ZF5b4/PifEcKDjMDOmIfCjo20kIxy2W6Wlm8XNmiq0wcSRaJYWDyxVhhg6NS93cruT/UQ== X-Received: by 2002:a05:6871:601:b0:196:7f51:286c with SMTP id w1-20020a056871060100b001967f51286cmr6325547oan.15.1684759159831; Mon, 22 May 2023 05:39:19 -0700 (PDT) Received: from storimasta ([2804:14c:5bb1:5200::e9eb]) by smtp.gmail.com with ESMTPSA id dw2-20020a056870770200b0019296ee9606sm2400482oab.4.2023.05.22.05.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 05:39:18 -0700 (PDT) From: Bruno Cardoso To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] lisp/org.el: allow org-return to call org-open-at-point on citations In-Reply-To: <87r0r8od3o.fsf@localhost> References: <87sfboekwe.fsf@gmail.com> <87r0r8od3o.fsf@localhost> Date: Mon, 22 May 2023 09:39:15 -0300 Message-ID: <87o7mcee18.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2001:4860:4864:20::34; envelope-from=cardoso.bc@gmail.com; helo=mail-oa1-x34.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, 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1684759220; a=rsa-sha256; cv=none; b=fxXuC94qlI+7woQV35n9wWpRmafmMPHD9oOr2foR1xX11SI7wCauvSTB7B1/R5wKs1Kfw4 /3fBQo+g+Fps4GvebMlwnYe5QyESlhBNQiXtJokCGelWPCx0IrnZy2mLuoRDwgSKqmmYWv bYY+CZPx+EFn1tyVZRRM/6he3rqA6CKkTqQmtaxX3JAyjshUFH8hrd+PcVJ/sljxMd304b zSl3EyUs4B73hYWvFFdWZsrHx+uDBqMnFm+hVg1yHxe4kt+7ct9nzyOdNnfqF8HIp6Bvui Xxscq8necW4+Jct49TCihnnEOuNU/BN7nztF8zQkJNQw6DYFvfN5nV4f5e1Ugw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=cEO81X2y; dmarc=pass (policy=none) header.from=gmail.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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1684759220; 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=uRtJRqaiaML4ujKuJw5yvYjqkDEullD8lJqBzFfMmx0=; b=RfMTaM9BS3/IlJXqknqeGeQAmdwiWIdFEUu4+3/0RPArBQH+sEGLDZBAFZ2zqmMf07ZuBG 15ebkAp31yDBAvc7l5IxKR0fFyyVlbCfCv+fFqHgQE2LFkdr6WMgTMrbSngkeD6eh9haBf /WmIzFGY+W3O1CNaCduEPVCfg6rIgvK8bIPrH/scgD8qA6fztlUSaZ5r2NMx6vzKgXZPM/ pfy3/jgpSCOCSpK5vhcrGJ46uHY2S0Hk+7uMogF2Thh6w8EYIX/6GoKsD0f1EtcD2hVsdF 44Q8bZ3lWTdspMo5zXf68djNSudQNnI7pY7wMzsIKxFYGpzwVfaJrODxx48y1Q== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=cEO81X2y; dmarc=pass (policy=none) header.from=gmail.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: -6.34 X-Spam-Score: -6.34 X-Migadu-Queue-Id: 4A5A02FFDF X-TUID: F2deWTTZnWI+ --=-=-= Content-Type: text/plain On 2023-05-22, 10:49 +0000, Ihor Radchenko wrote: > Thanks! > May you also update the docstring of `org-return-follows-link' and add > etc/ORG-NEWS entry? Hi Ihor, here's the updated patch as suggested. Best, Bruno. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-lisp-org.el-allow-org-return-to-call-org-open-at-poi.patch >From 436cd212507cc948af8de6f9e57b5e14e29f23dd Mon Sep 17 00:00:00 2001 From: bruno Date: Sun, 21 May 2023 15:53:42 -0300 Subject: [PATCH] lisp/org.el: allow org-return to call org-open-at-point on citations * lisp/org.el (org-return): When `org-return-follows-link' is non-nil and point is over an org-cite citation or citation reference, call `org-open-at-point'. TINYCHANGE --- etc/ORG-NEWS | 5 +++++ lisp/org-keys.el | 3 ++- lisp/org.el | 9 +++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 6b40198b5..ddf1e9110 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -221,6 +221,11 @@ Running shell blocks with the ~:session~ header freezes Emacs until execution completes. The new ~:async~ header allows users to continue editing with Emacs while a ~:session~ block executes. +*** ~org-return~ now acts on citations at point + +When ~org-return-follows-link~ is non-nil and cursor is over an +org-cite citation, ~org-return~ will call ~org-open-at-point~. + ** Miscellaneous *** =org-crypt.el= now applies initial visibility settings to decrypted entries diff --git a/lisp/org-keys.el b/lisp/org-keys.el index c62d62a1d..5f3ea8da3 100644 --- a/lisp/org-keys.el +++ b/lisp/org-keys.el @@ -299,7 +299,8 @@ implementation is bad." (defcustom org-return-follows-link nil "Non-nil means on links RET will follow the link. -In tables, the special behavior of RET has precedence." +In tables, the special behavior of RET has precedence. +On a timestamp or a citation, call `org-open-at-point'." :group 'org-link-follow :type 'boolean :safe #'booleanp) diff --git a/lisp/org.el b/lisp/org.el index 866af624e..8eab3ed22 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17774,8 +17774,8 @@ When optional INDENT argument is non-nil, call and INTERACTIVE. When `org-return-follows-link' is non-nil and point is on -a timestamp or a link, call `org-open-at-point'. However, it -will not happen if point is in a table or on a \"dead\" +a timestamp, a link or a citation, call `org-open-at-point'. +However, it will not happen if point is in a table or on a \"dead\" object (e.g., within a comment). In these case, you need to use `org-open-at-point' directly." (interactive "i\nP\np") @@ -17795,8 +17795,8 @@ object (e.g., within a comment). In these case, you need to use (insert "\n") (org-table-justify-field-maybe) (call-interactively #'org-table-next-row))) - ;; On a link or a timestamp, call `org-open-at-point' if - ;; `org-return-follows-link' allows it. Tolerate fuzzy + ;; On a link, a timestamp or a citation, call `org-open-at-point' + ;; if `org-return-follows-link' allows it. Tolerate fuzzy ;; locations, e.g., in a comment, as `org-open-at-point'. ((and org-return-follows-link (or (and (eq 'link element-type) @@ -17808,6 +17808,7 @@ object (e.g., within a comment). In these case, you need to use (> (point) origin)))) (org-in-regexp org-ts-regexp-both nil t) (org-in-regexp org-tsr-regexp-both nil t) + (org-element-lineage context '(citation citation-reference)) (org-in-regexp org-link-any-re nil t))) (call-interactively #'org-open-at-point)) ;; Insert newline in heading, but preserve tags. -- 2.40.1 --=-=-=--