bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#36343: 26.2; [PATCH] `view-echo-area-messages': set `window-point' t


From: Drew Adams
Subject: bug#36343: 26.2; [PATCH] `view-echo-area-messages': set `window-point' to `point-max'
Date: Sun, 23 Jun 2019 09:29:42 -0700 (PDT)

`C-h f view-echo-area-messages' says this:

  View the log of recent echo-area messages: the '*Messages*' buffer.
  The number of messages retained in that buffer
  is specified by the variable 'message-log-max'.

It does that.  But one might expect "view the log of recent" to mean
make the most recent msgs logged visible.  That doesn't happen if
`*Messages*' is already displayed in a window other than the selected
one.

This definition fixes that.  It just sets `window-point'.

Hopefully you don't need an explicit *.patch to apply this fix.

(defun view-echo-area-messages ()
  "View the log of recent echo-area messages: the `*Messages*' buffer.
The number of messages retained in that buffer is specified by the
variable `message-log-max'."
  (interactive)
  (with-current-buffer (messages-buffer)
    (goto-char (point-max))
    (let ((win  (display-buffer (current-buffer))))
      (set-window-point win (point))
      win)))

This definition doesn't do anything special to make all parts of the
buffer visible - it doesn't `widen' or show any text that might be
hidden.  It just makes sure that the most recent msgs that are aleady
visible are on-screen.  I think that's probably what we want.

---

If you really think the current behavior is what users expect, and you
think it should be kept as the default behavior, then please consider at
least letting a prefix arg set the window point to `point-max':

(defun view-echo-area-messages (arg)
  "View the log of recent echo-area messages: the `*Messages*' buffer.
The number of messages retained in that buffer is specified by the
variable `message-log-max'.  With a prefix arg move `window-point' to
`point-max'."
  (interactive "P")
  (with-current-buffer (messages-buffer)
    (goto-char (point-max))
    (let ((win  (display-buffer (current-buffer))))
      (when arg (set-window-point win (point)))
      win)))

The code above (both versions) returns the window, like the current
code.  Dunno whether that's important, but at least that behavior is
preserved, just in case something depends on it.

---

Note: You might also want to consider giving users the ability
(i.e. option) to ensure that `message' itself always moves
`window-point' to `point-max' in any window that is already displaying
`*Messages*'.  Just a suggestion - not part of this bug report.

See, for example, https://stackoverflow.com/q/4682033/729907.


In GNU Emacs 26.2 (build 1, x86_64-w64-mingw32)
 of 2019-04-13
Repository revision: fd1b34bfba8f3f6298df47c8e10b61530426f749
Windowing system distributor `Microsoft Corp.', version 10.0.17134
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''





reply via email to

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