unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* diff-autosaved
@ 2011-04-30  8:57 Andreas Röhler
  2011-04-30  9:48 ` diff-autosaved Andrea Crotti
  2011-04-30 10:30 ` diff-autosaved Andrea Crotti
  0 siblings, 2 replies; 5+ messages in thread
From: Andreas Röhler @ 2011-04-30  8:57 UTC (permalink / raw)
  To: help-gnu-emacs

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/



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-04-30 10:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-30  8:57 diff-autosaved Andreas Röhler
2011-04-30  9:48 ` diff-autosaved Andrea Crotti
2011-04-30 10:03   ` diff-autosaved Andreas Röhler
2011-04-30 10:31     ` diff-autosaved Andrea Crotti
2011-04-30 10:30 ` diff-autosaved Andrea Crotti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).