all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.