summaryrefslogtreecommitdiff
path: root/src/doc.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-12-30 23:17:45 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2021-12-30 23:17:45 -0500
commit59732a83c8875c8986d2221600d559a24d8309cc (patch)
tree610c6c18c51aad2fd04f54074a59bdd3354cd53e /src/doc.c
parent337005af0bf21244cabdc0b2a2c11d0095ecd0fa (diff)
downloademacs-59732a83c8875c8986d2221600d559a24d8309cc.tar.gz
emacs-59732a83c8875c8986d2221600d559a24d8309cc.tar.bz2
emacs-59732a83c8875c8986d2221600d559a24d8309cc.zip
Don't store docstrings of preloaded .el files in etc/DOC
Since the location of those files changes between build time and installation time, this requires to tweak the file name used in those (#$ . NNN) references during the dump so they don't hardcode the build directory. We do it in the same way as was already done for those same file names in `load-history`, except we convert them back to absolute file names more lazily (i.e. when fetching the actual docstring rather than at startup), which requires remembering the `lisp-dir` computed at startup in the new `lisp-directory` variable. * src/Makefile.in ($(etc)/DOC): Don't scan Lisp files any more. * src/lread.c (Fload): Use relative file names for `load-file-name` when preloading for the dump, like we already did for `current-load-list`. (read_list): Don't zero-out dynamic docstring references during the preload since they won't be filled later by Snarf-documentation any more. (read1): Remove the hash-hack for doc references that were zeroed. * lisp/startup.el (lisp-directory): New variable. (command-line): Set it. * src/doc.c (get_doc_string): Use `lisp-directory` for dynamic docstring references using relative file names. (syms_of_doc): Add `Qlisp_directory`. * lib-src/make-docfile.c (scan_file): Don't handle `.el` or `.elc` files any more. (IS_SLASH): Remove macro, not used any more. (skip_white, read_lisp_symbol, search_lisp_doc_at_eol) (scan_lisp_file): Remove functions, not used any more. * doc/lispref/loading.texi (Library Search): Mention `lisp-directory`.
Diffstat (limited to 'src/doc.c')
-rw-r--r--src/doc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/doc.c b/src/doc.c
index 6be023bb934..129d3a517b7 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -84,16 +84,19 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
char *from, *to, *name, *p, *p1;
Lisp_Object file, pos;
ptrdiff_t count = SPECPDL_INDEX ();
+ Lisp_Object dir;
USE_SAFE_ALLOCA;
if (FIXNUMP (filepos))
{
file = Vdoc_file_name;
+ dir = Vdoc_directory;
pos = filepos;
}
else if (CONSP (filepos))
{
file = XCAR (filepos);
+ dir = Fsymbol_value (Qlisp_directory);
pos = XCDR (filepos);
}
else
@@ -101,7 +104,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
EMACS_INT position = eabs (XFIXNUM (pos));
- if (!STRINGP (Vdoc_directory))
+ if (!STRINGP (dir))
return Qnil;
if (!STRINGP (file))
@@ -113,7 +116,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
Lisp_Object tem = Ffile_name_absolute_p (file);
file = ENCODE_FILE (file);
Lisp_Object docdir
- = NILP (tem) ? ENCODE_FILE (Vdoc_directory) : empty_unibyte_string;
+ = NILP (tem) ? ENCODE_FILE (dir) : empty_unibyte_string;
ptrdiff_t docdir_sizemax = SBYTES (docdir) + 1;
if (will_dump_p ())
docdir_sizemax = max (docdir_sizemax, sizeof sibling_etc);
@@ -703,6 +706,7 @@ See variable `text-quoting-style'. */)
void
syms_of_doc (void)
{
+ DEFSYM (Qlisp_directory, "lisp-directory");
DEFSYM (Qsubstitute_command_keys, "substitute-command-keys");
DEFSYM (Qfunction_documentation, "function-documentation");
DEFSYM (Qgrave, "grave");