summaryrefslogtreecommitdiff
path: root/src/lread.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/lread.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/lread.c')
-rw-r--r--src/lread.c49
1 files changed, 6 insertions, 43 deletions
diff --git a/src/lread.c b/src/lread.c
index 49925764146..55b3d473dce 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1545,7 +1545,7 @@ Return t if the file exists and loads successfully. */)
message_with_string ("Loading %s...", file, 1);
}
- specbind (Qload_file_name, found_eff);
+ specbind (Qload_file_name, hist_file_name);
specbind (Qload_true_file_name, found);
specbind (Qinhibit_file_name_operation, Qnil);
specbind (Qload_in_progress, Qt);
@@ -3224,23 +3224,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
Fstring_as_unibyte (AREF (tmp, COMPILED_BYTECODE)));
}
- if (COMPILED_DOC_STRING < ASIZE (tmp)
- && EQ (AREF (tmp, COMPILED_DOC_STRING), make_fixnum (0)))
- {
- /* read_list found a docstring like '(#$ . 5521)' and treated it
- as 0. This placeholder 0 would lead to accidental sharing in
- purecopy's hash-consing, so replace it with a (hopefully)
- unique integer placeholder, which is negative so that it is
- not confused with a DOC file offset (the USE_LSB_TAG shift
- relies on the fact that VALMASK is one bit narrower than
- INTMASK). Eventually Snarf-documentation should replace the
- placeholder with the actual docstring. */
- verify (INTMASK & ~VALMASK);
- EMACS_UINT hash = ((XHASH (tmp) >> USE_LSB_TAG)
- | (INTMASK - INTMASK / 2));
- ASET (tmp, COMPILED_DOC_STRING, make_ufixnum (hash));
- }
-
XSETPVECTYPE (vec, PVEC_COMPILED);
return tmp;
}
@@ -4208,31 +4191,13 @@ read_list (bool flag, Lisp_Object readcharfun)
/* While building, if the list starts with #$, treat it specially. */
if (EQ (elt, Vload_file_name)
- && ! NILP (elt)
- && !NILP (Vpurify_flag))
+ && ! NILP (elt))
{
- if (NILP (Vdoc_file_name))
- /* We have not yet called Snarf-documentation, so assume
- this file is described in the DOC file
- and Snarf-documentation will fill in the right value later.
- For now, replace the whole list with 0. */
- doc_reference = 1;
- else
- /* We have already called Snarf-documentation, so make a relative
- file name for this file, so it can be found properly
- in the installed Lisp directory.
- We don't use Fexpand_file_name because that would make
- the directory absolute now. */
- {
- AUTO_STRING (dot_dot_lisp, "../lisp/");
- elt = concat2 (dot_dot_lisp, Ffile_name_nondirectory (elt));
- }
+ if (!NILP (Vpurify_flag))
+ doc_reference = 0;
+ else if (load_force_doc_strings)
+ doc_reference = 2;
}
- else if (EQ (elt, Vload_file_name)
- && ! NILP (elt)
- && load_force_doc_strings)
- doc_reference = 2;
-
if (ch)
{
if (flag > 0)
@@ -4253,8 +4218,6 @@ read_list (bool flag, Lisp_Object readcharfun)
if (ch == ')')
{
- if (doc_reference == 1)
- return make_fixnum (0);
if (doc_reference == 2 && FIXNUMP (XCDR (val)))
{
char *saved = NULL;