Subject: Re: bug#50187: 28.0.50; tramp is called from calendar

From: Eli Zaretskii <[email-masked]>
Date: Fri, 16 Sep 2022 22:02:39 +0300

> Cc: Michael Heerdegen <[email-masked]>, [email-masked],
>  Lars Ingebrigtsen <[email-masked]>, Michael Albinus <[email-masked]>
> From: Sam Steingold <[email-masked]>
> Date: Fri, 16 Sep 2022 14:45:25 -0400
> 
> (setq-default default-directory (expand-file-name "~/"))
> 
> >> ... mostly because I was still hoping for a fix in Emacs ;-(
> >
> > It's not clear to me what the "fix" would be here, can you explain
> > what you have in mind?
> 
> 1. `default-directory' should have a global default, see above

But using "~/" as that default is IMO wrong, as it contradicts what
expand-file-name does when default-directory is nil: it uses "/" on
Posix systems and the root of the Emacs installation on MS-Windows.
If we want default-directory to have a global default (and I'm not yet
convinced that it's a good idea), we should at least use the same
value as expand-file-name does, otherwise we'll have bugs.

> 2. new buffers should inherit `default-directory' from the global
> default instead of the previous buffer from which this one was created.

I question the validity of this assertion.  It seems to be based on a
particular class of use cases, while its effect is over-reaching.
Consider, for example, the frequent paradigm of using
with-temp-buffer.