In emacs, can I set up the *Messages* buffer so that it tails?

Just put point at the end of the buffer M->. If you don't manually move it it will stay there -- IOW, you will always see the tail.


For multiple frames you probably want:

(defadvice message (after message-tail activate)
  "goto point max after a message"
  (with-current-buffer "*Messages*"
    (goto-char (point-max))
    (walk-windows (lambda (window)
                    (if (string-equal (buffer-name (window-buffer window)) "*Messages*")
                        (set-window-point window (point-max))))
                  nil
                  t)))

This code seems a bit overkill, but a the simple (goto-char (point-max)) wasn't working for me:

(defadvice message (after message-tail activate)
  "goto point max after a message"
  (with-current-buffer "*Messages*"
    (goto-char (point-max))
    (let ((windows (get-buffer-window-list (current-buffer) nil t)))
      (while windows
        (set-window-point (car windows) (point-max))
        (setq windows (cdr windows))))))

Tags:

Emacs