diff options
Diffstat (limited to 'lisp/vc/diff.el')
-rw-r--r-- | lisp/vc/diff.el | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index c04ff17ade7..523be87bc49 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -121,6 +121,8 @@ Possible values are: nil -- no, it does not check -- try to probe whether it does") +(defvar diff-default-directory) + (defun diff-no-select (old new &optional switches no-async buf) ;; Noninteractive helper for creating and reverting diff buffers (unless (bufferp new) (setq new (expand-file-name new))) @@ -165,6 +167,7 @@ Possible values are: (lambda (_ignore-auto _noconfirm) (diff-no-select old new switches no-async (current-buffer)))) (setq default-directory thisdir) + (setq diff-default-directory default-directory) (let ((inhibit-read-only t)) (insert command "\n")) (if (and (not no-async) (fboundp 'make-process)) @@ -226,8 +229,9 @@ With prefix arg, prompt for diff switches." "View the differences between BUFFER and its associated file. This requires the external program `diff' to be in your `exec-path'." (interactive "bBuffer: ") - (with-current-buffer (get-buffer (or buffer (current-buffer))) - (diff buffer-file-name (current-buffer) nil 'noasync))) + (let ((buf (get-buffer (or buffer (current-buffer))))) + (with-current-buffer (or (buffer-base-buffer buf) buf) + (diff buffer-file-name (current-buffer) nil 'noasync)))) (provide 'diff) |