summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien <bzg@gnu.org>2020-02-05 07:51:19 +0100
committerBastien <bzg@gnu.org>2020-02-05 07:51:19 +0100
commit07e9ad2aa23949f18875f3bbbcd72e28e0b62cf6 (patch)
tree51aa65e82430b7fb44f1d7ab6075c09579cc5ea5
parent19676dce758038749887a057208ea33d9a1fad57 (diff)
downloadorg-mode-07e9ad2aa23949f18875f3bbbcd72e28e0b62cf6.tar.gz
org-agenda.el: Fix for `org-agenda-open-link'
* lisp/org-agenda.el (org-agenda-open-link): Fix opening links that moves the point in the link buffer. Thanks to Ihor Radchenko for reporting this.
-rw-r--r--lisp/org-agenda.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index aed7f86..4fef62d 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8924,11 +8924,14 @@ It also looks at the text of the entry itself."
(setq trg (and (string-match org-link-bracket-re l)
(match-string 1 l)))
(if (or (not trg) (string-match org-link-any-re trg))
- (org-with-wide-buffer
- (goto-char marker)
- (when (search-forward l nil lkend)
- (goto-char (match-beginning 0))
- (org-open-at-point)))
+ ;; Don't use `org-with-wide-buffer' here as
+ ;; opening the link may result in moving the point
+ (save-restriction
+ (widen)
+ (goto-char marker)
+ (when (search-forward l nil lkend)
+ (goto-char (match-beginning 0))
+ (org-open-at-point)))
;; This is an internal link, widen the buffer
(switch-to-buffer-other-window buffer)
(widen)