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

前端 未结 6 720
借酒劲吻你
借酒劲吻你 2021-01-07 22:42

Basically I want the *Messages* buffer to always scroll to the bottom when a new message arrives.

Can I do that?

6条回答
  •  萌比男神i
    2021-01-07 23:09

    Here's an implementation that uses the new advice style.

    (defun message-buffer-goto-end-of-buffer (&rest args)
      (let* ((win (get-buffer-window "*Messages*"))
             (buf (and win (window-buffer win))))
        (and win (not (equal (current-buffer) buf))
             (set-window-point
              win (with-current-buffer buf (point-max))))))
    
    (advice-add 'message :after 'message-buffer-goto-end-of-buffer)
    

提交回复
热议问题