GNU bug report logs - #69606
[PATCH] Ensure default-directory exists when generating diff

Previous Next

Package: emacs;

Reported by: Philip Kaludercic <philipk <at> posteo.net>

Date: Thu, 7 Mar 2024 09:29:01 UTC

Severity: normal

Tags: patch

Fixed in version 31.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: Michael Albinus <michael.albinus <at> gmx.de>, 69606 <at> debbugs.gnu.org
Subject: bug#69606: [PATCH] Ensure default-directory exists when generating diff
Date: Sun, 16 Feb 2025 14:21:19 +0000
Philip Kaludercic <philipk <at> posteo.net> writes:

> From 761ee105380c60bcf410e3f3f6e15af8073b1549 Mon Sep 17 00:00:00 2001
> From: Philip Kaludercic <philipk <at> 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 a fresh temporary
> directory if 'default-directory' points to an invalid 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 70497a97d56..1aa4f87d1ea 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
> +                    (make-temp-file "emacs-diff" t))))
>      (with-current-buffer buf
>        (setq buffer-read-only t)
>        (buffer-disable-undo (current-buffer))
> --
> 2.47.2

Can we please also remove the temporary directory when we're done?




This bug report was last modified 84 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.