From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.help Subject: Re: How to follow the end of *Messages* buffer in Emacs? Date: Sat, 10 Nov 2012 12:56:14 +0100 Message-ID: <509E40DE.9040607@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1352548593 27107 80.91.229.3 (10 Nov 2012 11:56:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 10 Nov 2012 11:56:33 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: ybaumes@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 10 12:56:43 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TX9g3-00088w-35 for geh-help-gnu-emacs@m.gmane.org; Sat, 10 Nov 2012 12:56:43 +0100 Original-Received: from localhost ([::1]:47726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TX9ft-00069w-LY for geh-help-gnu-emacs@m.gmane.org; Sat, 10 Nov 2012 06:56:33 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TX9fm-00069p-2c for help-gnu-emacs@gnu.org; Sat, 10 Nov 2012 06:56:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TX9fj-0006Be-0Q for help-gnu-emacs@gnu.org; Sat, 10 Nov 2012 06:56:26 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:47128) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TX9fi-0006BY-Mv for help-gnu-emacs@gnu.org; Sat, 10 Nov 2012 06:56:22 -0500 Original-Received: (qmail invoked by alias); 10 Nov 2012 11:56:21 -0000 Original-Received: from 62-47-54-255.adsl.highway.telekom.at (EHLO [62.47.54.255]) [62.47.54.255] by mail.gmx.net (mp033) with SMTP; 10 Nov 2012 12:56:21 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19h4loUyDVhDr/bi0iMZP+93G7xwy86dARtx9n7iy a1BO/L7Y83yCfj Original-References: m2zk2qxucv.fsf@gmail.com X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.165.64.23 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87627 Archived-At: > 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