diff options
| author | Stephen Leake | 2019-04-11 13:58:36 -0700 |
|---|---|---|
| committer | Stephen Leake | 2019-04-11 13:58:36 -0700 |
| commit | 7768581172e11be52b1fcd8224f4594e126bbdb7 (patch) | |
| tree | 7c488e50653a6b5294e2662524b84701df62f76d | |
| parent | b29b79efd9752caf1e99273575a00b6769ddad56 (diff) | |
| download | emacs-7768581172e11be52b1fcd8224f4594e126bbdb7.tar.gz emacs-7768581172e11be52b1fcd8224f4594e126bbdb7.zip | |
Make `next-error' output fewer messages about locus
* lisp/simple.el (next-error-verbosity): New user variable.
(next-error, next-error-internal): Use it to control only outputting
locus message if locus changed.
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/simple.el | 33 |
2 files changed, 28 insertions, 9 deletions
| @@ -303,6 +303,10 @@ and directory-local variables. | |||
| 303 | 'with-connection-local-profiles'. No argument 'profiles' needed any | 303 | 'with-connection-local-profiles'. No argument 'profiles' needed any |
| 304 | longer. | 304 | longer. |
| 305 | 305 | ||
| 306 | --- | ||
| 307 | ** next-error-verbosity controls when `next-error' outputs a message | ||
| 308 | about the error locus. | ||
| 309 | |||
| 306 | 310 | ||
| 307 | * Editing Changes in Emacs 27.1 | 311 | * Editing Changes in Emacs 27.1 |
| 308 | 312 | ||
diff --git a/lisp/simple.el b/lisp/simple.el index 306df967661..be84e48cf4a 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -110,6 +110,15 @@ If non-nil, the value is passed directly to `recenter'." | |||
| 110 | :type 'hook | 110 | :type 'hook |
| 111 | :group 'next-error) | 111 | :group 'next-error) |
| 112 | 112 | ||
| 113 | (defcustom next-error-verbosity nil | ||
| 114 | "If nil, `next-error' always outputs the current error buffer. | ||
| 115 | If non-nil, the message is output only when the error buffer | ||
| 116 | changes." | ||
| 117 | :group 'next-error | ||
| 118 | :type 'boolean | ||
| 119 | :safe #'booleanp | ||
| 120 | :version "27.1") | ||
| 121 | |||
| 113 | (defvar next-error-highlight-timer nil) | 122 | (defvar next-error-highlight-timer nil) |
| 114 | 123 | ||
| 115 | (defvar next-error-overlay-arrow-position nil) | 124 | (defvar next-error-overlay-arrow-position nil) |
| @@ -312,21 +321,27 @@ To control which errors are matched, customize the variable | |||
| 312 | ;; We know here that next-error-function is a valid symbol we can funcall | 321 | ;; We know here that next-error-function is a valid symbol we can funcall |
| 313 | (with-current-buffer buffer | 322 | (with-current-buffer buffer |
| 314 | (funcall next-error-function (prefix-numeric-value arg) reset) | 323 | (funcall next-error-function (prefix-numeric-value arg) reset) |
| 315 | (next-error-found buffer (current-buffer)) | 324 | (let ((prev next-error-last-buffer)) |
| 316 | (message "%s locus from %s" | 325 | (next-error-found buffer (current-buffer)) |
| 317 | (cond (reset "First") | 326 | (when (or (not next-error-verbosity) |
| 318 | ((eq (prefix-numeric-value arg) 0) "Current") | 327 | (not (eq prev next-error-last-buffer))) |
| 319 | ((< (prefix-numeric-value arg) 0) "Previous") | 328 | (message "%s locus from %s" |
| 320 | (t "Next")) | 329 | (cond (reset "First") |
| 321 | next-error-last-buffer))))) | 330 | ((eq (prefix-numeric-value arg) 0) "Current") |
| 331 | ((< (prefix-numeric-value arg) 0) "Previous") | ||
| 332 | (t "Next")) | ||
| 333 | next-error-last-buffer))))))) | ||
| 322 | 334 | ||
| 323 | (defun next-error-internal () | 335 | (defun next-error-internal () |
| 324 | "Visit the source code corresponding to the `next-error' message at point." | 336 | "Visit the source code corresponding to the `next-error' message at point." |
| 325 | (let ((buffer (current-buffer))) | 337 | (let ((buffer (current-buffer))) |
| 326 | ;; We know here that next-error-function is a valid symbol we can funcall | 338 | ;; We know here that next-error-function is a valid symbol we can funcall |
| 327 | (funcall next-error-function 0 nil) | 339 | (funcall next-error-function 0 nil) |
| 328 | (next-error-found buffer (current-buffer)) | 340 | (let ((prev next-error-last-buffer)) |
| 329 | (message "Current locus from %s" next-error-last-buffer))) | 341 | (next-error-found buffer (current-buffer)) |
| 342 | (when (or (not next-error-verbosity) | ||
| 343 | (not (eq prev next-error-last-buffer))) | ||
| 344 | (message "Current locus from %s" next-error-last-buffer))))) | ||
| 330 | 345 | ||
| 331 | (defun next-error-found (&optional from-buffer to-buffer) | 346 | (defun next-error-found (&optional from-buffer to-buffer) |
| 332 | "Function to call when the next locus is found and displayed. | 347 | "Function to call when the next locus is found and displayed. |