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: Andrea Crotti
Subject: Re: reload modified files in buffer
Date: Tue, 14 Dec 2010 16:19:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin)

Rajinder Yadav <devguy.ca@gmail.com> writes:

> How can I get emacs to automatically reload files in its buffer that
> have been modified externally?
>
> When editing a rails app, if I run a rails generate command, I don't
> want to have to reload a file manually. Sometimes I start to edit a
> file that is out of sync in the buffer and then get into a mess. I
> would like this to happen transparently.

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...




reply via email to

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