unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Philip Kaludercic <philipk@posteo.net>
Cc: 69606@debbugs.gnu.org
Subject: bug#69606: [PATCH] Ensure default-directory exists when generating diff
Date: Thu, 07 Mar 2024 11:19:10 +0100	[thread overview]
Message-ID: <87bk7q2vkx.fsf@gmx.de> (raw)
In-Reply-To: <87v85yo0h7.fsf@posteo.net> (Philip Kaludercic's message of "Thu,  07 Mar 2024 09:27:48 +0000")

Philip Kaludercic <philipk@posteo.net> writes:

Hi Philip,

> 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))

I would use temporary-file-directory (or even
small-temporary-file-directory). Spamming the home directory with
(temporary) diff files doesn't sound like a good idea.

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

Perhaps, but I don't know whether there are undesired side effects, for
example when using relative file names. OTOH, if default-directory is
remote or unwritable, we might have problems anyway.

Best regards, Michael.





  reply	other threads:[~2024-03-07 10:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07  9:27 bug#69606: [PATCH] Ensure default-directory exists when generating diff Philip Kaludercic
2024-03-07 10:19 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bk7q2vkx.fsf@gmx.de \
    --to=bug-gnu-emacs@gnu.org \
    --cc=69606@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    --cc=philipk@posteo.net \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).