summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-01-24 16:41:38 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2020-01-24 16:46:42 -0800
commitf42d57c7dbd571b449270c8899a67e537561c2b2 (patch)
tree3750aa093fb8ac135c20a247e8d82c49b55bd8a4 /src
parent0c6c8aa002d321db61afdd14c70744f7bc27f268 (diff)
downloademacs-f42d57c7dbd571b449270c8899a67e537561c2b2.tar.gz
Install C source code for C-h f etc.
Without this change, on typical GNU/Linux distributions like Debian, the first button of ‘C-h f car RET’ does not work because the source code for ‘car’ is not installed (Bug#37527). Fix this by installing the (compressed) C source code alongside the (compressed) Lisp source code that is already installed. This adds about 3 MB (about 2%) to the size of the installed files on my platform. * Makefile.in (emacs_srcdir): New macro. (epaths-force): Substitute PATH_EMACS_SOURCE. (install-c-src): New rule, that installs a copy of the C source code if emacs_srcdir says to. (install-arch-indep): Depend on it. * configure.ac (emacs_srcdir): New var. Add support for --disable-install-srcdir. * lisp/emacs-lisp/find-func.el (find-function-C-source-directory): Look in emacs-source-directory first. (find-function-C-source): Also look for gzipped source files. * lisp/startup.el (normal-top-level): Also recode emacs-source-directory. * src/epaths.in (PATH_EMACS_SOURCE): New macro. * src/lread.c: Include dosname.h, for IS_ABSOLUTE_FILE_NAME. (syms_of_lread): New var emacs-source-directory.
Diffstat (limited to 'src')
-rw-r--r--src/epaths.in4
-rw-r--r--src/lread.c10
2 files changed, 13 insertions, 1 deletions
diff --git a/src/epaths.in b/src/epaths.in
index 3cadd160ecf..554fdd7228a 100644
--- a/src/epaths.in
+++ b/src/epaths.in
@@ -73,5 +73,9 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
/* Where Emacs should store game score files. */
#define PATH_GAME "/usr/local/var/games/emacs"
+/* Where Emacs should look for its own installed source code,
+ or the empty string if the source code is not installed. */
+#define PATH_EMACS_SOURCE "/usr/local/share/emacs"
+
/* Where Emacs should look for the application default file. */
#define PATH_X_DEFAULTS "/usr/lib/X11/%L/%T/%N%C%S:/usr/lib/X11/%l/%T/%N%C%S:/usr/lib/X11/%T/%N%C%S:/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S"
diff --git a/src/lread.c b/src/lread.c
index 69dd73912bc..274491f0229 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -44,6 +44,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "blockinput.h"
#include "pdumper.h"
#include <c-ctype.h>
+#include <dosname.h>
#include <vla.h>
#ifdef MSDOS
@@ -4992,11 +4993,18 @@ and is not meant for users to change. */);
DEFVAR_LISP ("source-directory", Vsource_directory,
doc: /* Directory in which Emacs sources were found when Emacs was built.
-You cannot count on them to still be there! */);
+You cannot count on them to still be there! Also see
+`emacs-source-directory'. */);
Vsource_directory
= Fexpand_file_name (build_string ("../"),
Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH, 0)));
+ DEFVAR_LISP ("emacs-source-directory", Vemacs_source_directory,
+ doc: /* Directory where Emacs sources can be found. */);
+ Vemacs_source_directory = (IS_ABSOLUTE_FILE_NAME (PATH_EMACS_SOURCE)
+ ? build_string (PATH_EMACS_SOURCE)
+ : Vsource_directory);
+
DEFVAR_LISP ("preloaded-file-list", Vpreloaded_file_list,
doc: /* List of files that were preloaded (when dumping Emacs). */);
Vpreloaded_file_list = Qnil;