Subject: Re: bug#48579: 28.0.50; Spawning an emacs process using call-process results in inconsistent, behavior between GNU/Linux and macOS

From: Eli Zaretskii <[email-masked]>
Date: Sat, 22 May 2021 16:09:05 +0300

> Cc: [email-masked], [email-masked]
> From: Daniel Mendler <[email-masked]>
> Date: Sat, 22 May 2021 14:54:26 +0200
> 
> > Right, no roadblocks.  And Emacs does determine that, for its own
> > purposes, on all platforms.  It just doesn't expose that to Lisp.
> 
> This statement does not seem correct to me. There is a default-directory
> which I can access in the initial *scratch* buffer. Something is exposed
> here.

We are mis-communicating.  All I'm saying is that this
default-directory is not (and doesn't have to be) the cwd of the Emacs
process.

> But this discussion here seems to be a bit off-track. My point here is
> that the current working directory determination on MacOS uses a
> heuristic, which is not correct. It incorrectly determines that Emacs
> has been launched from the finder or some other Mac GUI application and
> therefore changes the directory to the home directory. If Emacs is
> indeed started from the GUI, this makes all sense. But this is not the
> case here. The TTY heuristic, that Alan described, is insufficient.

I don't see why it matters what logic Emacs follows on macOS when its
starts, wrt the cwd of the Emacs process.

If you want to make sure that the default-directory of *scratch* is
the directory where Emacs was started, we could add such a feature (it
doesn't exists now, and relying on what you see on GNU/Linux means you
are relying on one particular implementation).  However, even if we do
introduce such a feature, that still won't tell you anything about the
cwd of the Emacs process.  If this latter aspect is what you really
care about, you will have to explain the rationale, because I don't
see how it could be important.