Function: diff-backup
diff-backup is an autoloaded, interactive and byte-compiled function
defined in diff.el.gz.
Signature
(diff-backup FILE &optional SWITCHES)
Documentation
Diff this file with its backup file or vice versa.
Uses the latest backup, if there are several numerical backups.
If this file is a backup, diff it with its original.
The backup file is the first file given to diff.
With prefix arg SWITCHES, prompt for diff switches.
Probably introduced at or before Emacs version 19.20.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/vc/diff.el.gz
;;;###autoload
(defun diff-backup (file &optional switches)
"Diff this file with its backup file or vice versa.
Uses the latest backup, if there are several numerical backups.
If this file is a backup, diff it with its original.
The backup file is the first file given to `diff'.
With prefix arg SWITCHES, prompt for diff switches."
(interactive (list (read-file-name "Diff (file with backup): ")
(diff-switches)))
(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))
(diff bak ori switches)))