From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: suvayu ali Newsgroups: gmane.emacs.help Subject: Re: reload modified files in buffer Date: Wed, 15 Dec 2010 07:43:59 -0800 Message-ID: References: <4D0714F3.5040704@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1292429479 23554 80.91.229.12 (15 Dec 2010 16:11:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 15 Dec 2010 16:11:19 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Andrea Crotti Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 15 17:11:14 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 1PStwf-0006pc-Il for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Dec 2010 17:11:13 +0100 Original-Received: from localhost ([127.0.0.1]:41468 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PStwf-0000b7-2B for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Dec 2010 11:11:13 -0500 Original-Received: from [140.186.70.92] (port=51724 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PStjy-00055K-N7 for help-gnu-emacs@gnu.org; Wed, 15 Dec 2010 10:58:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PStWf-0000Gc-Np for help-gnu-emacs@gnu.org; Wed, 15 Dec 2010 10:44:22 -0500 Original-Received: from mail-gw0-f48.google.com ([74.125.83.48]:55986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PStWf-0000GH-Ky for help-gnu-emacs@gnu.org; Wed, 15 Dec 2010 10:44:21 -0500 Original-Received: by gwaa20 with SMTP id a20so1478915gwa.35 for ; Wed, 15 Dec 2010 07:44:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=VyePdrVqs2LKGbjNsHPuG/OJKtf+2CEVjfWTpqj6iBk=; b=WJxH4Vux2DJ87RYK2LeD1QVc/RVqGm32eKwcJB+sJQ6WnvxVSxexBP7x8nDWtA6Opb B5MKMyCXy4kcxKttAp2jAcsm0/ttJ1SybK4GKVaVO7qeRqhuMu/leprusoSxHqlmer9y 1a5nkwt17kVZiOdHhoT80UhE8pYq3s+J0tfVo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=aEZZ48sQCiJex/R39upvnQFKJu1COy78Ip5oqsm35nsotqBqvzDbPg/MyUkUQukPUK /RcG7YsBDk8xpf0gM9DyQvXAFZ+xRrAnC03UJ0JBUisjAL3MqdjJ8RXFDWLfCIzwFrDw hIq2lqjse6recYXhx9bM+rYjBgLaHqkL4vH4o= Original-Received: by 10.147.40.1 with SMTP id s1mr1091678yaj.15.1292427859962; Wed, 15 Dec 2010 07:44:19 -0800 (PST) Original-Received: by 10.147.124.4 with HTTP; Wed, 15 Dec 2010 07:43:59 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: 1D1bpa1w_1538NVApurTNqlqcf4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:77550 Archived-At: Hi Andrea, On Tue, Dec 14, 2010 at 7:19 AM, Andrea Crotti wrote: > > I use this > --8<---------------cut here---------------start------------->8--- > =A0(defun is-git-file () > =A0 =A0"Return nil unless the file is in the git files" > =A0 =A0(if > =A0 =A0 =A0 =A0(member (file-name-nondirectory buffer-file-name) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(split-string =A0(shell-command-to-string = "git ls-files"))) > =A0 =A0 =A0 =A0(auto-revert-mode t))) > > =A0(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.