org-open-at-mouse: Fix regression when opening links outside Org mode

* lisp/org.el (org-open-at-mouse): Suppress parser warning when
attempting to open fontified Org links outside Org mode (for example,
in agenda buffers).  This is not a real fix - parser may still fail in
buffers where the surrounding link contents makes parser use
Org-specific local variables; but we at least recover from
deterioration of the behaviour when opening links worked _most of the
time_ without issues.

Reported-by: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
Link: https://orgmode.org/list/a864b26f-433e-49a8-8d58-74c9210e0fbd@gmail.com
This commit is contained in:
Ihor Radchenko 2024-10-20 13:36:17 +02:00
parent 8566bc8b45
commit dfd6cc51f5
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 13 additions and 1 deletions

View File

@ -8269,7 +8269,19 @@ See the docstring of `org-open-file' for details."
(mouse-set-point ev)
(when (eq major-mode 'org-agenda-mode)
(org-agenda-copy-local-variable 'org-link-abbrev-alist-local))
(org-open-at-point))
;; FIXME: This feature is actually unreliable - if we are in non-Org
;; buffer and the link happens to be inside what Org parser
;; recognizes as verbarim (for exampe, src block),
;; `org-open-at-point' will do nothing.
;; We might have used `org-open-at-point-global' instead, but it is
;; not exactly the same. For example, it will have no way to open
;; link abbreviations. So, suppressing parser complains about
;; non-Org buffer to keep the feature working at least to the extent
;; it did before.
(let ((warning-suppress-types
(cons '(org-element org-element-parser)
warning-suppress-types)))
(org-open-at-point)))
(defvar org-window-config-before-follow-link nil
"The window configuration before following a link.