[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: diff before recovering file
From: |
Andreas Röhler |
Subject: |
Re: diff before recovering file |
Date: |
Fri, 03 Aug 2012 11:28:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
Am 02.08.2012 16:34, schrieb Ivan Kanis:
Hi,
Has anyone written a function to see the difference between the file
viewed in the buffer and what would be recovered?
(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)))
Cheers,
Andreas
--
http://launchpad.net/python-mode
http://launchpad.net/s-x-emacs-werkstatt/