Subject: bug#37527: [PATCH] Install C source code for for debugging help

From: Eli Zaretskii <[email-masked]>
Date: Sun, 26 Jan 2020 18:13:27 +0200

> Cc: [email-masked], [email-masked], [email-masked],
>  [email-masked]
> From: Paul Eggert <[email-masked]>
> Date: Sun, 26 Jan 2020 01:00:34 -0800
> 
>     Thanks, but the name of this variable gives no clue about the sources
>     being installed as part of "make install", and neither does its
>     documentation.  How about emacs-installed-source-directory?
> 
> We don't use 'installed-' in other names that have similar roles, e.g., 'data-directory'. These variables and their uses don't care how the files got there, and their names and documentation should focus on what the variables are used for, not on the build process that set them up.

The files in those directories are always installed, and we never
reference them in the original source tree, so this is different.

> I thought it pretty clear during the discussion that it would be opt-out; that's what my original patch proposed, anyway. I don't see why we'd want it to be opt-in.

The discussion back then indicates that this wasn't clear at all.  I
suggested this to be off by default right at the beginning of the
discussion, and proposed to wait to hear user feedback first, see

  https://lists.gnu.org/archive/html/emacs-devel/2019-09/msg00581.html

Andreas said we should instead teach Emacs to look for the sources in
the debug source directory, see

  https://lists.gnu.org/archive/html/emacs-devel/2019-09/msg00584.html

Several other people opined that installing sources shouldn't be the
default, and some said right away that they will disable this if
installed.

Also, there was some kind of consensus that providing sources to be
installed by end-users is something the distros should do, and distros
don't need this turned on by default.  By contrast, users who build
their own Emacs are not very likely to want the sources installed the
second time.

Therefore, it sounds like making this the default is premature, and we
should change it to be an opt-in feature.

>           (defvar find-function-C-source-directory
>         -  (let ((dir (expand-file-name "src" source-directory)))
>         -    (if (file-accessible-directory-p dir) dir))
>         +  (let ((dir (expand-file-name "src" emacs-source-directory)))
>         +    (if (file-accessible-directory-p dir) dir
>         +      (setq dir (expand-file-name "src" source-directory))
>         +      (if (file-accessible-directory-p dir) dir)))
> 
>     This is backwards, IMO: it should first try the original source tree,
>     and only next the installed sources.
> 
> The original source tree location is unreliable and is documented to be unreliable, whereas the installed sources are supposed to match the Emacs you're running and that is more useful for C-h f and friends. I'd rather try the reliable copy first.

Which one is the reliable one depends on whether this option was
specified at configure time, and for users who install precompiled
distributions, also on whether they decide to install the sources.  So
they are both unreliable, but Emacs developers are much more likely to
have source-directory populated, so we should start with that.