(hs-hide-block): Fix message spelling.
[bpt/emacs.git] / lisp / diff.el
index 891fb97..eb2e415 100644 (file)
@@ -34,6 +34,9 @@
 (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 @@
@@ -196,7 +199,7 @@ With prefix arg, prompt for diff switches."
     (unwind-protect
        (let ((command
               (mapconcat 'identity
-                         (append '("diff")
+                         (append (list diff-command)
                                  ;; Use explicitly specified switches
                                  (if switches
                                      (if (consp switches)
@@ -266,8 +269,12 @@ The backup file is the first file given to `diff'."
       (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