unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Re: improve "next locus from <buffer>" messages
Date: Sun, 07 Apr 2019 08:55:25 -0800	[thread overview]
Message-ID: <86k1g5bvr6.fsf@stephe-leake.org> (raw)
In-Reply-To: <868swpdgeg.fsf@stephe-leake.org> (Stephen Leake's message of "Thu, 04 Apr 2019 05:55:03 -0800")

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

Stephen Leake <stephen_leake@stephe-leake.org> 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

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

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.
+
 \f
 * 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	other threads:[~2019-04-07 16:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86k1g5bvr6.fsf@stephe-leake.org \
    --to=stephen_leake@stephe-leake.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).