From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?= Newsgroups: gmane.emacs.help Subject: Re: diff-autosaved Date: Sat, 30 Apr 2011 12:03:11 +0200 Message-ID: <4DBBDE5F.9010503@easy-emacs.de> References: <4DBBCEE7.8030000@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1304157843 20249 80.91.229.12 (30 Apr 2011 10:04:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Apr 2011 10:04:03 +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 Sat Apr 30 12:03:58 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QG71q-0006pF-5C for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Apr 2011 12:03:58 +0200 Original-Received: from localhost ([::1]:34043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG71p-0005nQ-JS for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Apr 2011 06:03:57 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG71k-0005nJ-FP for help-gnu-emacs@gnu.org; Sat, 30 Apr 2011 06:03:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QG71j-0007Ps-Fc for help-gnu-emacs@gnu.org; Sat, 30 Apr 2011 06:03:52 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.10]:62163) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG71j-0007PS-4O for help-gnu-emacs@gnu.org; Sat, 30 Apr 2011 06:03:51 -0400 Original-Received: from [192.168.178.29] (brln-d9ba3219.pool.mediaWays.net [217.186.50.25]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0Md04s-1QX5g82txi-00Iaxy; Sat, 30 Apr 2011 12:03:46 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: X-Provags-ID: V02:K0:letAbagUljAAq/7Be5SEYJ63NPgvupKxmJ2q7UXFBAr H3vmOdTtEtYwYLds69NNytf3CH5OWPV6Cs7l3GuQduesyFJRRY fPr3qFnLjz2gSiUAM8J7fDOeTG6CvLzgoQ/CV4+GT+lrTi7ls7 Nmo7zI0IODy0Wlvs0AeWJgxyfyGRhHiyn4QEouHSu+Wut7QPla p9CqYF3IKWEBbwgtka6YDT98i5hiBvw0Sc59ZNcAgg= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.17.10 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:80876 Archived-At: Am 30.04.2011 11:48, schrieb Andrea Crotti: > Andreas Röhler writes: > >> Hi, >> >> occassionally want to compare a file with its auto-saved version. >> >> Couldn't find a function doing this. >> Tweaked diff-backup for the purpose. >> >> The result: >> >> >> (defun diff-autosaved (&optional switches) >> "Diff this file with its auto-saved version or vice versa. >> With prefix arg, prompt for diff switches." >> (interactive (list (diff-switches))) >> (let ((dir default-directory) >> (file (file-name-nondirectory (replace-regexp-in-string "#" "" >> (buffer-file-name)))) >> bak ori) >> (if (string-match "^#" file) >> (setq bak file >> ori (replace-regexp-in-string "#" "" file)) >> (setq bak (concat "#" file "#") >> ori file)) >> (setq bak (concat dir bak)) >> (setq ori (concat dir ori)) >> (diff bak ori switches))) >> >> >> Comments welcome. >> >> Andreas > > Nice I'll try it out... > But why do you want to compare with the auto-saved, and not for example > do diff-buffer-with-file? If an auto-saved exists, it means, buffer has not being saved at some time. diff-buffer-with-file doesn't relate to an existing auto-saved. It does: (diff buffer-file-name (current-buffer)... > > And also using revision control I just see the git/bzr/whatever diff > with the last committed version.. > If a buffer wasn't saved, VC will see no diff. Just the auto-save exists in this case. Cheers Andreas