(defvar diff-switches "-c"
"*A string or list of strings specifying switches to be be passed to diff.")
+(defvar diff-command "diff"
+ "*The command to use to run diff.")
+
(defvar diff-regexp-alist
'(
;; -u format: @@ -OLDSTART,OLDEND +NEWSTART,NEWEND @@
(unwind-protect
(let ((command
(mapconcat 'identity
- (append '("diff")
+ (append (list diff-command)
;; Use explicitly specified switches
(if switches
(if (consp switches)
(defun diff-latest-backup-file (fn) ; actually belongs into files.el
"Return the latest existing backup of FILE, or nil."
- (let ((handler (find-file-name-handler fn)))
+ (let ((handler (find-file-name-handler fn 'diff-latest-backup-file)))
(if handler
- (funcall handler fn)
+ (funcall handler 'diff-latest-backup-file fn)
;; First try simple backup, then the highest numbered of the
;; numbered backups.
;; Ignore the value of version-control because we look for existing
(or
(let ((bak (make-backup-file-name fn)))
(if (file-exists-p bak) bak))
- (let* ((dir (file-name-directory fn))
- (base-versions (concat (file-name-nondirectory fn) ".~"))
+ ;; We use BACKUPNAME to cope with backups stored in a different dir.
+ (let* ((backupname (car (find-backup-file-name fn)))
+ (dir (file-name-directory backupname))
+ (base-versions (concat (file-name-sans-versions
+ (file-name-nondirectory backupname))
+ ".~"))
(bv-length (length base-versions)))
(concat dir
(car (sort