GNU bug report logs - #48579
28.0.50; Spawning an emacs process using call-process results in inconsistent behavior between GNU/Linux and macOS

Previous Next

Package: emacs;

Reported by: Raj Krishnan <rajkrishnan1996 <at> gmail.com>

Date: Sat, 22 May 2021 07:36:02 UTC

Severity: minor

Tags: wontfix

Found in version 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #38 received at 48579 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Mendler <mail <at> daniel-mendler.de>
Cc: alan <at> idiocy.org, 48579 <at> debbugs.gnu.org
Subject: Re: bug#48579: 28.0.50; Spawning an emacs process using call-process
 results in inconsistent, behavior between GNU/Linux and macOS
Date: Sat, 22 May 2021 15:46:53 +0300
> Cc: alan <at> idiocy.org, 48579 <at> debbugs.gnu.org
> From: Daniel Mendler <mail <at> daniel-mendler.de>
> Date: Sat, 22 May 2021 14:37:35 +0200
> 
> > If this is what you think, then your concept of the default-directory
> > is in direct contradiction with how Emacs works.  The cwd of the Emacs
> > process is immaterial, and actually not even easily visible inside
> > Emacs.  When a buffer visits a file, Emacs makes a point of behaving
> > like that file's directory was its cwd.  For other buffers, my
> > suggestion is to consider their default-directory to be indeterminate,
> > and if you need it to have a specified value, you should force that by
> > calling 'cd' or setting default-directory explicitly.  Anything else
> > is bound to trip you some day, because it simply isn't how Emacs was
> > designed to behave.
> 
> I am aware that the file visiting buffers have a different
> default-directory. However the initial scratch buffer should inherit the
> current working directory of the parent process.

Like I said: this last expectation is wrong in Emacs.  The cwd of the
Emacs process is carefully concealed from Lisp, by design.  My advice
is not to make the assumption you do, because Emacs doesn't promise
you it will follow it.

> I don't see why some "indeterminate" or "undefined" behavior is
> justified here.

It is justified because that's how Emacs was designed.

> There is no technical roadblock preventing Emacs from determining the
> current directory (at least on Unixes).

Right, no roadblocks.  And Emacs does determine that, for its own
purposes, on all platforms.  It just doesn't expose that to Lisp.

> The problem is that the Mac Emacs port changes the directory
> according to its own standards.

I see no problem here.  There's nothing wrong with that behavior.

> Why do you call this "indeterminate", "undefined" or "random" behavior?
> Are there other examples where buffers have random directories?

They aren't random.




This bug report was last modified 2 years and 310 days ago.

Previous Next


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