unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36343: 26.2; [PATCH] `view-echo-area-messages': set `window-point' to `point-max'
@ 2019-06-23 16:29 Drew Adams
  2019-06-23 16:47 ` Drew Adams
  2019-07-06 14:48 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 3+ messages in thread
From: Drew Adams @ 2019-06-23 16:29 UTC (permalink / raw)
  To: 36343

`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''





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

* bug#36343: 26.2; [PATCH] `view-echo-area-messages': set `window-point' to `point-max'
  2019-06-23 16:29 bug#36343: 26.2; [PATCH] `view-echo-area-messages': set `window-point' to `point-max' Drew Adams
@ 2019-06-23 16:47 ` Drew Adams
  2019-07-06 14:48 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams @ 2019-06-23 16:47 UTC (permalink / raw)
  To: 36343

A question might be whether _all_ windows showing
`*Messages*' should be handled this way.

I figured that if someone has multiple such windows
then probably she does _not_ want all to be handled
this way.

Another possibility is to give users some control
over this via the prefix arg.





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

* bug#36343: 26.2; [PATCH] `view-echo-area-messages': set `window-point' to `point-max'
  2019-06-23 16:29 bug#36343: 26.2; [PATCH] `view-echo-area-messages': set `window-point' to `point-max' Drew Adams
  2019-06-23 16:47 ` Drew Adams
@ 2019-07-06 14:48 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-06 14:48 UTC (permalink / raw)
  To: Drew Adams; +Cc: 36343

Drew Adams <drew.adams@oracle.com> writes:

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

Makes sense.  I've inserted it in the Emacs trunk.

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

No, but that would be very convenient, especially if you write
ChangeLog-format change messages.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2019-07-06 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-23 16:29 bug#36343: 26.2; [PATCH] `view-echo-area-messages': set `window-point' to `point-max' Drew Adams
2019-06-23 16:47 ` Drew Adams
2019-07-06 14:48 ` Lars Ingebrigtsen

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