Enable auto-revert-tail-mode for log files from /var/log.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 19 Oct 2011 10:59:44 +0300
changeset 735 337d64d4f27b
parent 734 d5281f386f48
child 736 33d4749081b9
Enable auto-revert-tail-mode for log files from /var/log.
.emacs-my
--- a/.emacs-my	Wed Oct 19 10:34:56 2011 +0300
+++ b/.emacs-my	Wed Oct 19 10:59:44 2011 +0300
@@ -845,6 +845,16 @@
 (add-hook 'write-file-hooks 'time-stamp)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(message "logging, logs")
+
+(defun my-auto-revert-tail-mode-hook ()
+  (when (string-match "/var/log/.*\\.log\\'"
+                      (buffer-file-name (current-buffer)))
+    (auto-revert-tail-mode 1)
+    ))
+(add-hook 'find-file-hook 'my-auto-revert-tail-mode-hook)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "auto-fill")
 
 (setq-default fill-column 78)