From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#69606: [PATCH] Ensure default-directory exists when generating diff Date: Thu, 07 Mar 2024 09:27:48 +0000 Message-ID: <87v85yo0h7.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34464"; mail-complaints-to="usenet@ciao.gmane.io" To: 69606@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 07 10:28:56 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1riA3c-0008jy-3G for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 07 Mar 2024 10:28:56 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riA3F-0007Xc-3N; Thu, 07 Mar 2024 04:28:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1riA3D-0007RC-3f for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2024 04:28:31 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1riA3C-00065A-Rc for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2024 04:28:30 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riA3i-0004TH-4W for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2024 04:29:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Mar 2024 09:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69606 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170980371717137 (code B ref -1); Thu, 07 Mar 2024 09:29:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Mar 2024 09:28:37 +0000 Original-Received: from localhost ([127.0.0.1]:52548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riA3I-0004SL-U4 for submit@debbugs.gnu.org; Thu, 07 Mar 2024 04:28:37 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:41124) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riA3H-0004SA-3a for submit@debbugs.gnu.org; Thu, 07 Mar 2024 04:28:35 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1riA2f-0006wv-BR for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2024 04:28:00 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1riA2Z-00061W-4z for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2024 04:27:54 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 34AC0240103 for ; Thu, 7 Mar 2024 10:27:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1709803669; bh=HnNh2pytH0OZUnDpO/81kiV8SxG6+RFZbbd+OT1LOp0=; h=From:To:Subject:OpenPGP:Date:Message-ID:MIME-Version:Content-Type: From; b=p9yBiwoRUk20k04P6/QZQbPWviOqq1XkjsgNZ3s+fIWE1fW2L8p6fS13Dod1j/tZP btSyt12QjKcx79hfe5Erqc/Bq708FxbSaOdHVG/5CYnCkPBTAQh70UA3pTlkZLDwD4 Nw2OvCtLSWMcV8fZlqWFdhRYC2H9wx+YKEM3KqxJu6R6hyH6SuOcVdh/Pmt9bZjPKm C17aZdgH4r6jccUOb2K1a7wOiY9YZVHbvQetOQnf2hq8IKoLt65sN6tyC02b0UBadS 4UOE4PrTjmw7IjBqdvexWjIqo7tT2zflIIJvDqh8awo1NFYaOmPVdJcR3u8Tucbf1E r0a4KTuhBAL4g== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Tr3qm5mYPz9rxP for ; Thu, 7 Mar 2024 10:27:48 +0100 (CET) OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:281155 Archived-At: --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Ensure-default-directory-exists-when-generating-di.patch Content-Description: [PATCH] Ensure default-directory exists when generating diff >From 73a93310a9f38b15a7a849b75b4ea2b3805041ad Mon Sep 17 00:00:00 2001 From: Philip Kaludercic 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 --=-=-= Content-Type: text/plain Any other ideas? Perhaps we should always set the default directory to that -- Philip Kaludercic on peregrine --=-=-=--