|
From: | Oleksandr Gavenko |
Subject: | Re: auto-revert-mode |
Date: | Tue, 14 Sep 2010 22:33:42 +0300 |
User-agent: | Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
Thamer Mahmoud wrote:
Oleksandr Gavenko <gavenko@bifit.com.ua> writes:(add-to-list 'find-file-hook (lambda nil (when (equal (file-name-extension (buffer-file-name)) "log") (auto-revert-mode 1) ;; or (auto-revert-tail-mode 1) !! ))) I don't know more efficient way to do this.Here is another solution:(add-to-list 'auto-mode-alist '("\\.foo\\'" (lambda () (auto-revert-mode 1)) t))
auto-mode-alist is a variable defined in `files.el'. Documentation: Alist of filename patterns vs corresponding major mode functions. ... If the element has the form (REGEXP FUNCTION NON-NIL), then after calling FUNCTION (if it's not nil), we delete the suffix that matched REGEXP and search the list again for another match. So if my file has name my.c.foo and I open it I got file in major c-mode and minor auto-revert-mode! Beside side effect of this hack for me interesting how 'auto-mode-alist' processed - invoke major mode once for first regex match on for all matches? So if for your .foo extension desired some major mode you may hid it by minor mode! -- Best regards!
[Prev in Thread] | Current Thread | [Next in Thread] |