emacs-devel
[Top][All Lists]
Advanced

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

Re: improve "next locus from <buffer>" messages


From: Stephen Leake
Subject: Re: improve "next locus from <buffer>" messages
Date: Sun, 07 Apr 2019 08:55:25 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (windows-nt)

Stephen Leake <address@hidden> writes:


> I'll put back the "first/current/previous", and add a custom option to
> control this.

Updated patch attached. I added a NEWS entry; I'm not clear if the new
defcustom should be mentioned in the Emacs manual at (emacs) Compilation
Mode.

-- 
-- Stephe
diff --git a/etc/NEWS b/etc/NEWS
index 26c761ae01..59a97b6b9c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -303,6 +303,10 @@ and directory-local variables.
 'with-connection-local-profiles'.  No argument 'profiles' needed any
 longer.
 
+---
+** next-error-suppress-locus-message controls when `next-error'
+   outputs a message about the error locus.
+
 
 * Editing Changes in Emacs 27.1
 
diff --git a/lisp/simple.el b/lisp/simple.el
index 306df96766..4bb4116842 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -110,6 +110,15 @@ next-error-hook
   :type 'hook
   :group 'next-error)
 
+(defcustom next-error-suppress-locus-message nil
+  "If nil, `next-error' always outputs the current error buffer.
+If non-nil, the message is output only when the error buffer
+changes."
+  :group 'next-error
+  :type 'boolean
+  :safe #'booleanp
+  :version "27.1")
+
 (defvar next-error-highlight-timer nil)
 
 (defvar next-error-overlay-arrow-position nil)
@@ -312,21 +321,27 @@ 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)))))
+        (let ((prev next-error-last-buffer))
+          (next-error-found buffer (current-buffer))
+          (when (or (not next-error-suppress-locus-message)
+                    (not (eq prev next-error-last-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)))))))
 
 (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)))
+    (let ((prev next-error-last-buffer))
+      (next-error-found buffer (current-buffer))
+      (when (or (not next-error-suppress-locus-message)
+                (not (eq prev next-error-last-buffer)))
+        (message "Current locus from %s" next-error-last-buffer)))))
 
 (defun next-error-found (&optional from-buffer to-buffer)
   "Function to call when the next locus is found and displayed.

reply via email to

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