summaryrefslogtreecommitdiff
path: root/lisp/ediff.el
diff options
context:
space:
mode:
authorMarkus Rost <rost@math.uni-bielefeld.de>2002-07-31 22:29:36 +0000
committerMarkus Rost <rost@math.uni-bielefeld.de>2002-07-31 22:29:36 +0000
commit3755bd32c9022973de835c42ffdadde1beb32f3a (patch)
tree350c209298e30da1bb5f070d782b0a48f92adf81 /lisp/ediff.el
parent32d9a725a59ca66fa15d0491defdc4c37dd1b46b (diff)
downloademacs-3755bd32c9022973de835c42ffdadde1beb32f3a.tar.gz
(ediff-backup): New autoloaded command.
Diffstat (limited to 'lisp/ediff.el')
-rw-r--r--lisp/ediff.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/ediff.el b/lisp/ediff.el
index 2db82f85547..5b0f85d05cd 100644
--- a/lisp/ediff.el
+++ b/lisp/ediff.el
@@ -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)