From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-15?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: diff-autosaved Date: Sat, 30 Apr 2011 10:57:11 +0200 Message-ID: <4DBBCEE7.8030000@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1304153888 1760 80.91.229.12 (30 Apr 2011 08:58:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Apr 2011 08:58:08 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 30 10:58:04 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 1QG604-0008E3-0H for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Apr 2011 10:58:04 +0200 Original-Received: from localhost ([::1]:45998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG603-0001Wv-KG for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Apr 2011 04:58:03 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:57641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG5zy-0001Wq-I0 for help-gnu-emacs@gnu.org; Sat, 30 Apr 2011 04:57:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QG5zx-0004ar-6E for help-gnu-emacs@gnu.org; Sat, 30 Apr 2011 04:57:58 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.10]:65438) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG5zw-0004ad-O7 for help-gnu-emacs@gnu.org; Sat, 30 Apr 2011 04:57:57 -0400 Original-Received: from [192.168.178.29] (brln-d9ba3219.pool.mediaWays.net [217.186.50.25]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MgHFG-1QTmrP1imE-00NKKz; Sat, 30 Apr 2011 10:57:53 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 X-Provags-ID: V02:K0:6qw8sfVB0g2mEAiunDYQq4amCGXpaU5V75kGfs8DgKV Pz6WPqHJYdKVWIEWj9/18VpVQzcZvoiojDhbPCrNDsWzP6WO5V zOx/pmmrO75L3bbJVYeDXSU9m96QgUDqwL7vzl2YXDq9ygkbeG bjp7UYHlzPF7wTQhKuOX+SucYIihW090oJgwBg0fTg+RMEYkxo JcEtZFULy0GtD6435zEHnFzw1XbeR1jo91mD+CNMa8= 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:80874 Archived-At: 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 -- https://code.launchpad.net/~a-roehler/python-mode/components-python-mode https://code.launchpad.net/s-x-emacs-werkstatt/