unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: warnings and window-point
Date: Fri, 22 Nov 2019 02:01:24 +0100	[thread overview]
Message-ID: <CAAeL0SRF4UrztHCJVTCYibAzJVRA7OBjVcH6en9CAmob+Jzueg@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2019-11-22  1:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22  1:01 Juanma Barranquero [this message]
2019-11-22  8:05 ` warnings and window-point Eli Zaretskii
2019-11-22  8:43   ` Juanma Barranquero
2019-11-22 15:24     ` Stefan Monnier

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=CAAeL0SRF4UrztHCJVTCYibAzJVRA7OBjVcH6en9CAmob+Jzueg@mail.gmail.com \
    --to=lekktu@gmail.com \
    --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).