[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sat, 30 Apr 2011 12:03:11 +0200
Mozilla/5.0 (X11; U; Linux i686; de; rv:184.108.40.206) Gecko/20110303 Thunderbird/3.1.9
Am 30.04.2011 11:48, schrieb Andrea Crotti:
Andreas Röhler<address@hidden> writes:
occassionally want to compare a file with its auto-saved version.
Couldn't find a function doing this.
Tweaked diff-backup for the purpose.
(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 "#" ""
(if (string-match "^#" file)
(setq bak file
ori (replace-regexp-in-string "#" "" file))
(setq bak (concat "#" file "#")
(setq bak (concat dir bak))
(setq ori (concat dir ori))
(diff bak ori switches)))
Nice I'll try it out...
But why do you want to compare with the auto-saved, and not for example
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.
(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.