unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* improve "next locus from <buffer>" messages
@ 2019-04-03 17:50 Stephen Leake
  2019-04-03 18:20 ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Leake @ 2019-04-03 17:50 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: error_locus.diff --]
[-- Type: text/x-patch, Size: 2870 bytes --]

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.

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-04-14 16:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 17:50 improve "next locus from <buffer>" messages Stephen Leake
2019-04-03 18:20 ` Eli Zaretskii
2019-04-03 20:53   ` Stephen Leake
2019-04-03 21:22     ` Stephen Leake
2019-04-04  9:26       ` Felician Nemeth
2019-04-04 13:41         ` Stephen Leake
2019-04-04 14:09           ` Dmitry Gutov
2019-04-04 12:54     ` Eli Zaretskii
2019-04-04 13:55       ` Stephen Leake
2019-04-07 16:55         ` Stephen Leake
2019-04-08 19:21           ` Juri Linkov
2019-04-08 22:16             ` [SPAM UNSURE] " Stephen Leake
2019-04-13 20:56               ` Juri Linkov
2019-04-14 16:25                 ` [SPAM UNSURE] " Stephen Leake

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).