From: Philip Kaludercic <philipk@posteo.net>
To: 69606@debbugs.gnu.org
Subject: bug#69606: [PATCH] Ensure default-directory exists when generating diff
Date: Thu, 07 Mar 2024 09:27:48 +0000 [thread overview]
Message-ID: <87v85yo0h7.fsf@posteo.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 569 bytes --]
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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Ensure default-directory exists when generating diff --]
[-- Type: text/x-patch, Size: 1008 bytes --]
From 73a93310a9f38b15a7a849b75b4ea2b3805041ad Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
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
[-- Attachment #3: Type: text/plain, Size: 116 bytes --]
Any other ideas? Perhaps we should always set the default directory to
that
--
Philip Kaludercic on peregrine
next reply other threads:[~2024-03-07 9:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 9:27 Philip Kaludercic [this message]
2024-03-07 10:19 ` bug#69606: [PATCH] Ensure default-directory exists when generating diff Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-08 7:47 ` Philip Kaludercic
2024-03-09 16:45 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v85yo0h7.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=69606@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.