branch: externals-release/org commit 1059e78c0b8bef749843a014fe4a857f69be0693 Author: Ihor Radchenko <yanta...@posteo.net> Commit: Ihor Radchenko <yanta...@posteo.net>
org-return: Do not err on spaces after citation * lisp/org.el (org-return): When `org-return-follows-link' is set, do not try following citation when on blank lines after citation. Same as with normal links. Reported-by: Tyler Smith <ty...@plantarum.ca> Link: https://orgmode.org/list/10ba9f6c-8f85-470b-b675-7a7989736...@app.fastmail.com --- lisp/org.el | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index f7dd46f3d9..7b1e676c9e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18548,17 +18548,22 @@ object (e.g., within a comment). In these case, you need to use ;; 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) - ;; Ensure point is not on the white spaces after - ;; the link. - (let ((origin (point))) - (org-with-point-at (org-element-end context) - (skip-chars-backward " \t") - (> (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) 'include-self) - (org-in-regexp org-link-any-re nil t))) + (or + (let ((context + (org-element-lineage + context + '(citation citation-reference link) + 'include-self))) + (and context + ;; Ensure point is not on the white spaces after + ;; the link. + (let ((origin (point))) + (org-with-point-at (org-element-end context) + (skip-chars-backward " \t") + (> (point) origin))))) + (org-in-regexp org-ts-regexp-both nil t) + (org-in-regexp org-tsr-regexp-both nil t) + (org-in-regexp org-link-any-re nil t))) (call-interactively #'org-open-at-point)) ;; Insert newline in heading, but preserve tags. ((and (not (bolp))