diff options
author | Juri Linkov <juri@linkov.net> | 2024-04-22 09:50:45 +0300 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2024-04-22 09:50:45 +0300 |
commit | 086608876ad4e3aacdce7169206482cef0cb7129 (patch) | |
tree | 91d9e685ec06eab58d084f2c79995b64fa5615b3 /lisp/emacs-lisp | |
parent | d51b0d2ebe4d0f55993e8e13f6d35b1eb23abf52 (diff) | |
download | emacs-086608876ad4e3aacdce7169206482cef0cb7129.tar.gz |
* lisp/emacs-lisp/warnings.el (warning-display-at-bottom): New defcustom.
(display-warning): Use 'warning-display-at-bottom' to display
the warning buffer at the bottom of the screen and to scroll
to the last warning message (bug#69983).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/warnings.el | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el index 8b43c6a8726..6a1187fdb0f 100644 --- a/lisp/emacs-lisp/warnings.el +++ b/lisp/emacs-lisp/warnings.el @@ -120,6 +120,14 @@ so only the element (FOO) will match it. See also `warning-suppress-log-types'." :type '(repeat (repeat symbol)) :version "22.1") + +(defcustom warning-display-at-bottom t + "Display the warning buffer at the bottom of the screen. +The output window will be scrolled to the bottom of the buffer +to show the last warning message." + :type 'boolean + :version "30.1") + ;; The autoload cookie is so that programs can bind this variable ;; safely, testing the existing value, before they call one of the @@ -362,10 +370,21 @@ entirely by setting `warning-suppress-types' or (or (< (warning-numeric-level level) (warning-numeric-level warning-minimum-level)) (warning-suppress-p type warning-suppress-types) - (let ((window (display-buffer buffer))) + (let ((window (display-buffer + buffer + (when warning-display-at-bottom + '(display-buffer--maybe-at-bottom + (window-height . (lambda (window) + (fit-window-to-buffer window 10))) + (category . warning)))))) (when (and (markerp warning-series) (eq (marker-buffer warning-series) buffer)) (set-window-start window warning-series)) + (when warning-display-at-bottom + (with-selected-window window + (goto-char (point-max)) + (set-window-point window (1- (point-max))) + (recenter -1))) (sit-for 0))))))))) ;; Use \\<special-mode-map> so that help-enable-autoload can do its thing. |