all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to follow the end of *Messages* buffer in Emacs?
@ 2012-11-09 22:52 Yves Baumes
  2012-11-10  6:39 ` B. T. Raven
  2012-11-10 10:07 ` Peter Dyballa
  0 siblings, 2 replies; 13+ messages in thread
From: Yves Baumes @ 2012-11-09 22:52 UTC (permalink / raw)
  To: help-gnu-emacs

I am playing with Elisp, and I find convenient to have the *Messages*
buffer always open in a window in my frame.

I discovered recently that sometimes the buffer stops following the last
lines. If I want to see the last appended lines in this buffer, I need
to go in the buffer and jump to the end manually, with M->. Which is
quite annoying and disruptive.

I am trying to reproduce the "tail -f" command line, in a buffer. Of
course 'auto-revert-tail-mode complains that the *Messages* is not a
visited file... As a consequence, this mode does not want to work. But
it gave me the idea to add a function hook when the buffer is modified.
That function would jump to (point-max) each time that buffer is
modified.

Here is my own attempt, invoked from *Messages* buffer, with M-:
(add-hook
 'after-change-functions
 (lambda (s e l) (goto-char (point-max)))
 nil t)

But it does not work. The (point) remains in the same place while I see
the buffer is growing... The lambda function does not produce any error,
otherwise it would have been removed from the 'after-change-functions
hook and C-h k 'after-change-functions shows it is present.

Any better suggestions?


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: How to follow the end of *Messages* buffer in Emacs?
@ 2012-11-10 11:56 martin rudalics
  0 siblings, 0 replies; 13+ messages in thread
From: martin rudalics @ 2012-11-10 11:56 UTC (permalink / raw)
  To: ybaumes; +Cc: help-gnu-emacs

 > I am playing with Elisp, and I find convenient to have the *Messages*
 > buffer always open in a window in my frame.
 >
 > I discovered recently that sometimes the buffer stops following the last
 > lines. If I want to see the last appended lines in this buffer, I need
 > to go in the buffer and jump to the end manually, with M->. Which is
 > quite annoying and disruptive.

Can you please tell us when and how this happens.  Here, when I display
*Messages* in a window, I always see the last line but maybe something
about my setup is peculiar.

 > I am trying to reproduce the "tail -f" command line, in a buffer. Of
 > course 'auto-revert-tail-mode complains that the *Messages* is not a
 > visited file... As a consequence, this mode does not want to work. But
 > it gave me the idea to add a function hook when the buffer is modified.
 > That function would jump to (point-max) each time that buffer is
 > modified.
 >
 > Here is my own attempt, invoked from *Messages* buffer, with M-:
 > (add-hook
 >  'after-change-functions
 >  (lambda (s e l) (goto-char (point-max)))
 >  nil t)
 >
 > But it does not work. The (point) remains in the same place while I see
 > the buffer is growing... The lambda function does not produce any error,
 > otherwise it would have been removed from the 'after-change-functions
 > hook and C-h k 'after-change-functions shows it is present.

The (goto-char (point-max)) just sets `point' in that buffer.  It does
not care whether the buffer is currently displayed in a window.  You
have to use something like

   (walk-windows
    (lambda (w)
      (when (eq (window-buffer w) (current-buffer))
        (set-window-point w (point-max))))))

within that function.

martin



^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <mailman.12681.1352548591.855.help-gnu-emacs@gnu.org>]
* Re: How to follow the end of *Messages* buffer in Emacs?
@ 2012-11-12  9:57 martin rudalics
  0 siblings, 0 replies; 13+ messages in thread
From: martin rudalics @ 2012-11-12  9:57 UTC (permalink / raw)
  To: monnier; +Cc: help-gnu-emacs

 > IIUC we already have that buffer-local variable (it's called
 > window-point-insertion-type).

You understand correctly ;-)

martin



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

end of thread, other threads:[~2012-11-12  9:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-09 22:52 How to follow the end of *Messages* buffer in Emacs? Yves Baumes
2012-11-10  6:39 ` B. T. Raven
2012-11-10 10:07 ` Peter Dyballa
  -- strict thread matches above, loose matches on Subject: below --
2012-11-10 11:56 martin rudalics
     [not found] <mailman.12681.1352548591.855.help-gnu-emacs@gnu.org>
2012-11-10 15:55 ` Yves Baumes
     [not found] ` <m2bof5l4lx.fsf@gmail.com>
2012-11-10 18:51   ` martin rudalics
     [not found]   ` <mailman.12702.1352573476.855.help-gnu-emacs@gnu.org>
2012-11-10 19:56     ` Yves Baumes
2012-11-10 21:02       ` martin rudalics
     [not found]       ` <mailman.12713.1352581388.855.help-gnu-emacs@gnu.org>
2012-11-10 22:00         ` Yves Baumes
2012-11-12  9:56           ` martin rudalics
2012-11-10 22:24         ` Yves Baumes
2012-11-11 17:25     ` Stefan Monnier
2012-11-12  9:57 martin rudalics

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.