X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/a617e9133c6854861e327f90fe5f096a33abe4f3..ebfa69444dce5d5d807aaf0b067cd01259b85e51:/lisp/diff.el diff --git a/lisp/diff.el b/lisp/diff.el index 891fb97044..eb2e415289 100644 --- a/lisp/diff.el +++ b/lisp/diff.el @@ -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