changeset 46766:bc3820ad92b2

(ediff-backup): New autoloaded command.
author Markus Rost <rost@math.uni-bielefeld.de>
date Wed, 31 Jul 2002 22:29:00 +0000
parents af4505d3e0f8
children c9ae2bc01262
files lisp/ediff.el
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ediff.el	Wed Jul 31 22:28:30 2002 +0000
+++ b/lisp/ediff.el	Wed Jul 31 22:29:00 2002 +0000
@@ -367,6 +367,22 @@
 ;;;###autoload
 (defalias 'ediff 'ediff-files)
 
+;;;###autoload
+(defun ediff-backup (file)
+  "Run Ediff on FILE and its backup file.
+Uses the latest backup, if there are several numerical backups.
+If this file is a backup, `ediff' it with its original."
+  (interactive (list (read-file-name "Ediff (file with backup): ")))
+  ;; The code is taken from `diff-backup'.
+  (require 'diff)
+  (let (bak ori)
+    (if (backup-file-name-p file)
+	(setq bak file
+	      ori (file-name-sans-versions file))
+      (setq bak (or (diff-latest-backup-file file)
+		    (error "No backup found for %s" file))
+	    ori file))
+    (ediff-files bak ori)))
 
 ;;;###autoload
 (defun ediff-buffers (buffer-A buffer-B &optional startup-hooks job-name)