bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18851: 24.4; emacs cannot be started if the current directory has be


From: Vincent Lefevre
Subject: bug#18851: 24.4; emacs cannot be started if the current directory has been removed
Date: Wed, 29 Oct 2014 17:44:08 +0100
User-agent: Mutt/1.5.23-6365-vl-r59709 (2014-09-07)

On 2014-10-29 18:07:33 +0200, Eli Zaretskii wrote:
> You can assume without testing that there will be problems, because
> Emacs expects to find a meaningful default-directory in *scratch*.

What will it do with this default-directory?

> > Well, it happens that the current directory is removed for some
> > reasons, either on purpose or because of some FS error (in particular
> > if the FS is remote). Now, I may have already an application running
> > with this current directory, for instance, a MUA. If I want to write
> > a mail, the MUA will start an editor on an absolute pathname, Emacs
> > in my case, with the same current directory. But Emacs cannot be
> > started, just because the current directory no longer exists, meaning
> > that I can't write my mail without restarting the whole application.
> 
> Can't you use the --chdir command-line argument to make Emacs start in
> a safe place?  Or does that not work in this situation?

It will work in some cases. But this means that it's not usable for
$EDITOR, because there are cases where the editor may be executed
with a relative pathname argument. In such a case, this argument
should be handled normally if the directory still exists. Otherwise
one should get either an error or the specified file (under Linux,
one can still open relative pathnames starting with ../ even though
the current working directory has been deleted), but getting another
file is not acceptable. With a --chdir to $HOME, there is a high risk
to get this wrong; to "/", the risk is lower, but still exists.

Unfortunately, it isn't even possible to --chdir to the old path
(obtained via /proc/$$/cwd under Linux), as the directory typically
no longer exists when I need to do that, and Emacs cannot chdir to
it, obviously. An option to set the default default-directory value
and accept non-existing directories[*] would be more useful.

[*] I suppose that this is not a problem since an existing directory
can be removed after Emacs is started, so that the default-directory
variable could point to a non-existing directory, and the current
Emacs version is fine with that (things still work, and errors are
reported gracefully).

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]