[Top][All Lists]

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

warnings and window-point

From: Juanma Barranquero
Subject: warnings and window-point
Date: Fri, 22 Nov 2019 02:01:24 +0100

Not sure if that's a bug or a feature, because it's been so since the beginning (it already happens in 22.1, where warnings.el was introduced). But it is definitely weird.

Warnings are added at the end of the *Warnings* buffer, and the buffer is displayed, but the window-point does not move. So if you write a lot of warnings, like

(dotimes (i 40) (lwarn 'emacs :warning "i = %d" i))

only the beginning of the buffer is shown, and the window-point is stuck at the beginning of the *second* warning in the buffer. Basically, if you have the *Warnings* buffer open in some window, but you don't scroll it, once the window is full, you're unaware that new warnings are appearing.

Perhaps the idea is to keep past warnings visible until the user scrolls the buffer themself, but if warning-series is set, display-warning calls set-window-start and sets the origin of the window at the first warning of the series (and weirdly, the window-point is not reset to the first visible position in the window).

(dotimes (i 100)
  (when (= i 50) (setq warning-series t))
  (lwarn 'emacs :warning "i = %d" i))

What I would've expected is something like this:

diff --git i/lisp/emacs-lisp/warnings.el w/lisp/emacs-lisp/warnings.el
index e5c1d9cec4..c9d7aff529 100644
--- i/lisp/emacs-lisp/warnings.el
+++ w/lisp/emacs-lisp/warnings.el
@@ -316,7 +316,8 @@ display-warning
                     (warning-suppress-p type warning-suppress-types)
                     (let ((window (display-buffer buffer)))
-                      (when (and (markerp warning-series)
-                                 (eq (marker-buffer warning-series) buffer))
-                        (set-window-start window warning-series))
+                      (if (and (markerp warning-series)
+                               (eq (marker-buffer warning-series) buffer))
+                          (set-window-start window warning-series)
+                        (set-window-point window end))
                       (sit-for 0)))))))))

reply via email to

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