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

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

Re: reload modified files in buffer


From: suvayu ali
Subject: Re: reload modified files in buffer
Date: Wed, 15 Dec 2010 07:43:59 -0800

Hi Andrea,

On Tue, Dec 14, 2010 at 7:19 AM, Andrea Crotti
<andrea.crotti.0@gmail.com> wrote:
>
> I use this
> --8<---------------cut here---------------start------------->8---
>  (defun is-git-file ()
>    "Return nil unless the file is in the git files"
>    (if
>        (member (file-name-nondirectory buffer-file-name)
>                (split-string  (shell-command-to-string "git ls-files")))
>        (auto-revert-mode t)))
>
>  (add-hook 'find-file-hook 'is-git-file)
> --8<---------------cut here---------------end--------------->8---
>
> to set files in auto-revert mode if they're part of a git repository.
> Maybe you can adapt something like this to your needs.
> Having everything in auto-revert mode might slow down too much...

Any particular reason to write your own function? I simply use this,

(lambda ()
          (if (vc-working-revision (buffer-file-name))
                (auto-revert-mode t)))

--
Suvayu

Open source is the future. It sets us free.



reply via email to

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