unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* warnings and window-point
@ 2019-11-22  1:01 Juanma Barranquero
  2019-11-22  8:05 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2019-11-22  1:01 UTC (permalink / raw)
  To: Emacs developers

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

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)))))))))

[-- Attachment #2: Type: text/html, Size: 2424 bytes --]

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

end of thread, other threads:[~2019-11-22 15:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22  1:01 warnings and window-point Juanma Barranquero
2019-11-22  8:05 ` Eli Zaretskii
2019-11-22  8:43   ` Juanma Barranquero
2019-11-22 15:24     ` Stefan Monnier

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).