emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bruno Cardoso <cardoso.bc@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] lisp/org.el: allow org-return to call org-open-at-point on citations
Date: Mon, 22 May 2023 07:10:57 -0300	[thread overview]
Message-ID: <87sfboekwe.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]


Hello everyone.

This patch is a tiny change that allows `org-return' to call `org-open-at-point' when cursor is over org-cite citations.

Best,

Bruno.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org.el-allow-org-return-to-call-org-open-at-poi.patch --]
[-- Type: text/x-patch, Size: 2165 bytes --]

From 19409cbf70958aa1d7f508cd7151f36a92212341 Mon Sep 17 00:00:00 2001
From: bruno <cardoso.bc@gmail.com>
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 citantion reference, call `org-open-at-point'.

TINYCHANGE
---
 lisp/org.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

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


             reply	other threads:[~2023-05-22 10:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 10:10 Bruno Cardoso [this message]
2023-05-22 10:49 ` [PATCH] lisp/org.el: allow org-return to call org-open-at-point on citations Ihor Radchenko
2023-05-22 12:39   ` Bruno Cardoso
2023-05-25 12:26     ` Ihor Radchenko

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=87sfboekwe.fsf@gmail.com \
    --to=cardoso.bc@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).