branch: externals/org
commit 62a8677e4c479d3ff5364b9141770bd4922a0fe0
Merge: e6fae2e34d 1059e78c0b
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    Merge branch 'bugfix'
---
 lisp/org.el | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index d012819a9c..0d6f787b26 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18158,17 +18158,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))

Reply via email to