瀏覽代碼

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.
Bastien 5 年之前
父節點
當前提交
07e9ad2aa2
共有 1 個文件被更改,包括 8 次插入5 次删除
  1. 8 5
      lisp/org-agenda.el

+ 8 - 5
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)