Subject: Re: bug#36828: 27.0.50; Uninstalled emacs shows installed documentation

From: Eli Zaretskii <[email-masked]>
Date: Sun, 28 Jul 2019 19:50:12 +0300

> From: Óscar Fuentes <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 28 Jul 2019 17:56:28 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Emacs tries the installation directory first, and only falls back to
> > the build directory if the installation directory doesn't exist.
> 
> Does this happen if Emacs was never installed from that build directory?

AFAIR, Emacs doesn't know.  It just looks in several directories
according to some order, and that order makes sense in the usual use
cases.  Yours is an unusual one.

> And is there a good reason for doing that? When Emacs is executed from
> the build directory, I expect that it works on the contents of that
> directory (and the correspondent source directory, for out-of-tree
> builds.)

We are talking about data-directory.  The convoluted logic for its
calculation is in callproc.c, near the end.  You will see that there
are quite a few use cases supported by that code.  There could be
EMACS_DATA in the environment; there could be a list of directories to
look in, not just a single directory; the build directory may or may
not be the same as the source directory.  The value you see is probed
early on during the startup, when Emacs didn't yet figure out the
value of installation-directory, and so cannot yet employ the logic
you want it to.  For an uninstalled Emacs that directory usually
doesn't exist, so later Emacs tries again after figuring out the
installation-directory.

Bottom line: I'm not sure we should rock that particular boat for an
unusual use case such as yours.