help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: auto-revert-mode


From: Deniz Dogan
Subject: Re: auto-revert-mode
Date: Tue, 14 Sep 2010 11:06:01 +0200

2010/9/14 Gary <help-gnu-emacs@garydjones.name>:
> I know I can use M-x auto-revert-mode to turn this on manually on a per
> buffer basis, but is there any way to do so for all files matching the
> pattern ".*\.foo" (for example)? I tried adding it to the mode hook
> related to "foo" files but it didn't work for some reason.
>
> --
> Gary        Please do NOT send me 'courtesy' replies off-list.
> GNU Emacs 23.2.1
> emacsclient 23.2
> 1.7.7(0.230/5/3) 2010-08-31 09:58 Cygwin
>
>
>

This seems to work for me:

(add-hook 'find-file-hook 'auto-revert-mode)

That will affect all files and file extensions. I can't see any reason
why it wouldn't work for just about any hook. Are you sure
foo-mode-hook is executed at all?

As a last resort, you can use something like this (untested):

(add-hook
 'find-file-hook
 (lambda ()
   (when (string-match "\\.foo\\'" buffer-file-name)
     (auto-revert-mode 1))))

-- 
Deniz Dogan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]