emacs-devel
[Top][All Lists]
Advanced

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

improve "next locus from <buffer>" messages


From: Stephen Leake
Subject: improve "next locus from <buffer>" messages
Date: Wed, 03 Apr 2019 09:50:20 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (windows-nt)

Currently, next-error always outputs a message "next locus from
<buffer>". In the vast majority of cases, <buffer> does not change from
one message to the next, so this message is just annoying.

The attached patch changes it so the message is only output when the
locus changes.

It also gets rid of the "first/current/previous" options; what matters
is where the _next_ error will come from.

Comments?

-- 
-- Stephe
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 5bfb0bf901..1d5b932ba1 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1825,6 +1825,8 @@ compilation-start
        (goto-char (point-max))))
 
     ;; Make it so the next C-x ` will use this buffer.
+    (when (not (eq outbuf next-error-last-buffer))
+      (message "next locus from %s" outbuf))
     (setq next-error-last-buffer outbuf)))
 
 (defun compilation-set-window-height (window)
diff --git a/lisp/simple.el b/lisp/simple.el
index 306df96766..832c62ffb3 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -312,34 +312,31 @@ next-error
       ;; 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)
-        (next-error-found buffer (current-buffer))
-        (message "%s locus from %s"
-                 (cond (reset                             "First")
-                       ((eq (prefix-numeric-value arg) 0) "Current")
-                       ((< (prefix-numeric-value arg) 0)  "Previous")
-                       (t                                 "Next"))
-                 next-error-last-buffer)))))
+        (next-error-found buffer (current-buffer))))))
 
 (defun next-error-internal ()
   "Visit the source code corresponding to the `next-error' message at point."
   (let ((buffer (current-buffer)))
     ;; We know here that next-error-function is a valid symbol we can funcall
     (funcall next-error-function 0 nil)
-    (next-error-found buffer (current-buffer))
-    (message "Current locus from %s" next-error-last-buffer)))
+    (next-error-found buffer (current-buffer))))
 
 (defun next-error-found (&optional from-buffer to-buffer)
   "Function to call when the next locus is found and displayed.
 FROM-BUFFER is a buffer from which next-error navigated,
 and TO-BUFFER is a target buffer."
-  (setq next-error-last-buffer (or from-buffer (current-buffer)))
-  (when to-buffer
-    (with-current-buffer to-buffer
-      (setq next-error-buffer from-buffer)))
-  (when next-error-recenter
-    (recenter next-error-recenter))
-  (funcall next-error-found-function from-buffer to-buffer)
-  (run-hooks 'next-error-hook))
+  (let ((prev next-error-last-buffer)
+        (next (or from-buffer (current-buffer))))
+    (when (not (eq prev next))
+      (message "next locus from %s" next))
+    (setq next-error-last-buffer next)
+    (when to-buffer
+      (with-current-buffer to-buffer
+        (setq next-error-buffer from-buffer)))
+    (when next-error-recenter
+      (recenter next-error-recenter))
+    (funcall next-error-found-function from-buffer to-buffer)
+    (run-hooks 'next-error-hook)))
 
 (defun next-error-select-buffer (buffer)
   "Select a `next-error' capable BUFFER and set it as the last used.

reply via email to

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