diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index 1aa4f87d1ea..bb509d0d4e3 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -188,9 +188,10 @@ diff-no-select (list (or old-alt old) (or new-alt new))))) " ")) - (thisdir (if (file-exists-p default-directory) - default-directory - (make-temp-file "emacs-diff" t)))) + (use-temp-dir (not (file-exists-p default-directory))) + (thisdir (if use-temp-dir + (make-temp-file "emacs-diff" t) + default-directory))) (with-current-buffer buf (setq buffer-read-only t) (buffer-disable-undo (current-buffer)) @@ -220,6 +221,8 @@ diff-no-select (call-process shell-file-name nil buf nil shell-command-switch command) old-alt new-alt)))) + (when use-temp-dir + (delete-directory thisdir t)) buf)) (defun diff-process-filter (proc string)