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

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

Re: Auto revert mode but only for git projects


From: Andrea Crotti
Subject: Re: Auto revert mode but only for git projects
Date: Mon, 07 Jun 2010 22:27:09 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (darwin)

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

[...]


I solved with something like 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---

It doesn't really make sense to look at branches since for every pull we
could have to revert...
Apparently it's working, if you have some hints/complaints/suggestions
don't hesitate




reply via email to

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