跟随emacs中的缓冲区,尾部-f或更小+ F
收藏

I would like to analyze a log file in emacs while it is growing. Is it possible to have a buffer follow a file? It is not needed that the file be editable (which raises all sort of questions): read-only mode would suffice.

我的问题更详细地是这样的:

  1. I open the logfile en emacs
  2. I am looking for some error in the logfile
  3. I realize it is not there because the buffer is not up-to-date
  4. I have to manually reload the buffer (revert-buffer)

I would like to improve this workflow by letting emacs do the reloading automagically. Maybe a periodic revert-buffer? How to setup such periodic reloading?

最佳答案

Use the auto-revert-tail-mode to do this... I have following in my ~/.emacs (just to convenience...):

(add-to-list 'auto-mode-alist '("\\.log\\'" . auto-revert-mode))

    公众号
    关注公众号订阅更多技术干货!