Subject: bug#69606: closed (Re: bug#69606: [PATCH] Ensure default-directory exists when generating diff)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 21 Feb 2025 13:50:02 +0000

Your bug report

#69606: [PATCH] Ensure default-directory exists when generating diff

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
69606: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69606
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#69606: [PATCH] Ensure default-directory exists when generating diff
From: Michael Albinus <[email-masked]>
To: Stefan Kangas <[email-masked]>
Cc: Philip Kaludercic <[email-masked]>, [email-masked]
Date: Fri, 21 Feb 2025 14:49:17 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 31.1

Stefan Kangas <[email-masked]> writes:

>> The question is how we bring it to Emacs 30. Pushing to the emacs-30
>> branch (perhaps too late due to the release candidate). Or pushing to
>> master, and ask Srefan to add this to the to-be-merged-from-master-after-the-release-list.
>
> The latter is probably best at this point, thanks.

Pushed to master, closing the bug.

Best regards, Michael.

Subject: [PATCH] Ensure default-directory exists when generating diff
From: Philip Kaludercic <[email-masked]>
To: [email-masked]
Date: Thu, 07 Mar 2024 09:27:48 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

When I generate a diff in some directory that I would afterwards delete,
the diff buffer appears to remain in the now non-existent directory
(according to `default-directory'), even if I want to generate a diff
for some other file.  The issue now is that make-process complains that
it cannot set the CWD when starting "diff", and instead fails with a
slightly confusing error message:

  start-process: Setting current directory: No such file or directory, /some/directory/that/doesnt/exist/anymore

This would fix the issue, but I don't think the solution is ideal:

>From 73a93310a9f38b15a7a849b75b4ea2b3805041ad Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <[email-masked]>
Date: Thu, 7 Mar 2024 10:06:48 +0100
Subject: [PATCH] Ensure default-directory exists when generating diff

* lisp/vc/diff.el (diff-no-select): Fall back to the users home
directory if default-directory is not a valid path.
---
 lisp/vc/diff.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index a64fbc47853..47566dbc40b 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -188,7 +188,9 @@ diff-no-select
                                   (list (or old-alt old)
                                         (or new-alt new)))))
 		     " "))
-	 (thisdir default-directory))
+	 (thisdir (if (file-exists-p default-directory)
+                      default-directory
+                    (expand-file-name "~"))))
     (with-current-buffer buf
       (setq buffer-read-only t)
       (buffer-disable-undo (current-buffer))
-- 
2.44.0

Any other ideas?  Perhaps we should always set the default directory to
that 

-- 
	Philip Kaludercic on peregrine