[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: auto-revert-mode
From: |
Stefan Monnier |
Subject: |
Re: auto-revert-mode |
Date: |
Wed, 08 Dec 2010 15:28:36 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>>> (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))
In Emacs-24 you'll be able to just say
(add-to-list 'auto-mode-alist '("\\.foo\\'" auto-revert-mode t))
> With the sideeffect of inhibiting the proper major-mode for .foo files.
> Maybe this calls for another variable `auto-minor-mode-alist'.
No, the t he put at the end tells Emacs to keep looking for a major mode
(but I'm not sure if his incantation will work because the subsequent
call to the major mode may end up turning off auto-revert-mode, I'm
afraid).
Stefan