]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix recent change in diff-no-select
authorMichael Albinus <michael.albinus@gmx.de>
Fri, 28 Feb 2025 17:03:54 +0000 (18:03 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 4 Mar 2025 20:51:57 +0000 (21:51 +0100)
* lisp/vc/diff.el (diff-no-select): Keep initial default directory
in *Diff* buffer.

(cherry picked from commit 0af5c5749988180c6a2f7c50b7e1c8163b4c5bf1)

lisp/vc/diff.el

index 9987e303e25b423d7e1d38c87e8e36c14b89ace6..ebbe1fb27e78da6c0dfc1368d6fd2524b6f87a06 100644 (file)
@@ -188,7 +188,8 @@ returns the buffer used."
                                               (prin1-to-string new))))
                                   (list (or old-alt old)
                                         (or new-alt new)))))
-                    " ")))
+                    " "))
+        (thisdir default-directory))
     (with-current-buffer buf
       (setq buffer-read-only t)
       (buffer-disable-undo (current-buffer))
@@ -199,14 +200,15 @@ returns the buffer used."
       (setq-local revert-buffer-function
                   (lambda (_ignore-auto _noconfirm)
                     (diff-no-select old new switches no-async (current-buffer))))
-      (setq default-directory temporary-file-directory)
+      (setq default-directory thisdir)
       (setq diff-default-directory default-directory)
       (let ((inhibit-read-only t))
        (insert command "\n"))
       (with-file-modes #o600
         (if (and (not no-async) (fboundp 'make-process))
-           (let ((proc (start-process "Diff" buf shell-file-name
-                                       shell-command-switch command)))
+           (let* ((default-directory temporary-file-directory)
+                   (proc (start-process "Diff" buf shell-file-name
+                                        shell-command-switch command)))
              (set-process-filter proc #'diff-process-filter)
               (set-process-sentinel
                proc (lambda (proc _msg)
@@ -214,7 +216,8 @@ returns the buffer used."
                         (diff-sentinel (process-exit-status proc)
                                        old-alt new-alt)))))
          ;; Async processes aren't available.
-         (let ((inhibit-read-only t))
+         (let* ((default-directory temporary-file-directory)
+                 (inhibit-read-only t))
            (diff-sentinel
             (call-process shell-file-name nil buf nil
                           shell-command-switch command)