Emacs中自动刷新dired缓冲区
Emacs中自动刷新dired缓冲区
在dired模式中,如果在不同buffer间切换,buffer不会自动更新,有时还需要手工按“g”键,比较麻烦,如下设置和代码能够在buffer切换和执行shell命令后自动更新dired buffer:
;; 切换buffer后,立即刷新 (defadvice switch-to-buffer (after revert-buffer-now activate) (if (eq major-mode 'dired-mode) (revert-buffer))) ;; 执行shell-command后,立即刷新 (defadvice shell-command (after revert-buffer-now activate) (if (eq major-mode 'dired-mode) (revert-buffer))) ;; 在Bookmark中进入dired buffer时自动刷新 (dired-auto-revert-buffer t)