emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 9071ac6: Override possible change of next-error-las


From: Juri Linkov
Subject: [Emacs-diffs] master 9071ac6: Override possible change of next-error-last-buffer in next-error-function
Date: Mon, 6 Nov 2017 16:41:10 -0500 (EST)

branch: master
commit 9071ac63aecf96879ec9807257c7b0cae8e8b18e
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    Override possible change of next-error-last-buffer in next-error-function
    
    * lisp/simple.el (next-error, next-error-internal):
    Setq next-error-last-buffer after next-error-function call.
    (Bug#28864)
---
 lisp/simple.el | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 372e153..375a79e 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -279,23 +279,28 @@ To control which errors are matched, customize the 
variable
 `compilation-error-regexp-alist'."
   (interactive "P")
   (if (consp arg) (setq reset t arg nil))
-  (when (setq next-error-last-buffer (next-error-find-buffer))
-    ;; we know here that next-error-function is a valid symbol we can funcall
-    (with-current-buffer next-error-last-buffer
-      (funcall next-error-function (prefix-numeric-value arg) reset)
-      (when next-error-recenter
-        (recenter next-error-recenter))
-      (run-hooks 'next-error-hook))))
+  (let ((buffer (next-error-find-buffer)))
+    (when buffer
+      ;; We know here that next-error-function is a valid symbol we can funcall
+      (with-current-buffer buffer
+        (funcall next-error-function (prefix-numeric-value arg) reset)
+        ;; Override possible change of next-error-last-buffer in 
next-error-function
+        (setq next-error-last-buffer buffer)
+        (when next-error-recenter
+          (recenter next-error-recenter))
+        (run-hooks 'next-error-hook)))))
 
 (defun next-error-internal ()
   "Visit the source code corresponding to the `next-error' message at point."
-  (setq next-error-last-buffer (current-buffer))
-  ;; we know here that next-error-function is a valid symbol we can funcall
-  (with-current-buffer next-error-last-buffer
-    (funcall next-error-function 0 nil)
-    (when next-error-recenter
-      (recenter next-error-recenter))
-    (run-hooks 'next-error-hook)))
+  (let ((buffer (current-buffer)))
+    ;; We know here that next-error-function is a valid symbol we can funcall
+    (with-current-buffer buffer
+      (funcall next-error-function 0 nil)
+      ;; Override possible change of next-error-last-buffer in 
next-error-function
+      (setq next-error-last-buffer buffer)
+      (when next-error-recenter
+        (recenter next-error-recenter))
+      (run-hooks 'next-error-hook))))
 
 (defalias 'goto-next-locus 'next-error)
 (defalias 'next-match 'next-error)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]