all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 36343@debbugs.gnu.org
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)	[thread overview]
Message-ID: <a1a8eaf2-d3fa-41d5-9bc3-e7c26866f0cd@default> (raw)

`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	other threads:[~2019-06-23 16:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-23 16:29 Drew Adams [this message]
2019-06-23 16:47 ` bug#36343: 26.2; [PATCH] `view-echo-area-messages': set `window-point' to `point-max' Drew Adams
2019-07-06 14:48 ` Lars Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a1a8eaf2-d3fa-41d5-9bc3-e7c26866f0cd@default \
    --to=drew.adams@oracle.com \
    --cc=36343@debbugs.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.