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

From: Daniel Mendler <[email-masked]>
Date: Sat, 22 May 2021 14:41:22 +0200

On 5/22/21 2:29 PM, Eli Zaretskii wrote:
>> From: Daniel Mendler <[email-masked]>
>> Date: Sat, 22 May 2021 14:14:53 +0200
>>
>>> If you want Emacs on macOS to work like a Unix command line app, then
>>> build it as a Unix command line app, not a macOS GUI app.
>>
>> I am not talking about GUI vs terminal, the problem here is if Emacs is
>> started from a script. Would it be possible to adjust the directory
>> changing behavior, for example if Emacs is started with the arguments
>> `--daemon`, `--batch` or `--script`? Is there another way to detect if
>> the finder launched Emacs, such that only in that case the directory
>> changing to the home directory takes place?
> 
> That won't help.  The initial directory in which Emacs starts can be
> controlled that way, but that's not what you will see in some random
> buffer's default-directory.  It is completely OK for Emacs to change
> its cwd, as far as the OS is concerned, after it was started, because
> that directory doesn't affect how Emacs works.

I am not talking about a random directory of some random buffer. Of
course these buffers have default-directories depending on if a file is
visited and so on. I am talking about the default-directory of the
initial *scratch* buffer, which runs the script loaded directly after
launch. This is relevant in case you want to start worker jobs executing
some code asynchronously for example, related to the current discussion
on the mailing list (emacsclient in elisp).

Daniel