From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrea Crotti Newsgroups: gmane.emacs.help Subject: Re: reload modified files in buffer Date: Tue, 14 Dec 2010 16:19:13 +0100 Message-ID: References: <4D0714F3.5040704@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1292340013 3191 80.91.229.12 (14 Dec 2010 15:20:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 14 Dec 2010 15:20:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 14 16:20:09 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PSWff-0007ko-AW for geh-help-gnu-emacs@m.gmane.org; Tue, 14 Dec 2010 16:20:07 +0100 Original-Received: from localhost ([127.0.0.1]:41898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSWfe-0004EB-Ks for geh-help-gnu-emacs@m.gmane.org; Tue, 14 Dec 2010 10:20:06 -0500 Original-Received: from [140.186.70.92] (port=47832 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSWf2-0004B8-S6 for help-gnu-emacs@gnu.org; Tue, 14 Dec 2010 10:19:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PSWf1-0003bu-Qz for help-gnu-emacs@gnu.org; Tue, 14 Dec 2010 10:19:28 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:36601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PSWf1-0003bb-Ir for help-gnu-emacs@gnu.org; Tue, 14 Dec 2010 10:19:27 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PSWez-0007PN-KF for help-gnu-emacs@gnu.org; Tue, 14 Dec 2010 16:19:25 +0100 Original-Received: from ip1-201.halifax.rwth-aachen.de ([137.226.108.201]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Dec 2010 16:19:25 +0100 Original-Received: from andrea.crotti.0 by ip1-201.halifax.rwth-aachen.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Dec 2010 16:19:25 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 25 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ip1-201.halifax.rwth-aachen.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:Yo35BHu3solPh3AIbrMHOWUp+vQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:77494 Archived-At: Rajinder Yadav 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...