diff options
author | Andrea Corallo <akrl@sdf.org> | 2020-04-13 16:54:03 +0100 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-04-13 18:09:13 +0100 |
commit | 05adf0353faf0bff3da60230a691b381de297843 (patch) | |
tree | 155649e38e4b43783706fc91ec399d4c41ae9b15 /src/lread.c | |
parent | 1c5548f1c51b44b78d05deb11a31b8678df7b4e7 (diff) | |
download | emacs-05adf0353faf0bff3da60230a691b381de297843.tar.gz emacs-05adf0353faf0bff3da60230a691b381de297843.tar.bz2 emacs-05adf0353faf0bff3da60230a691b381de297843.zip |
Fix function find mechanism for installed instance.
* src/lread.c (parent_directory): New function.
(Fload): Make use of 'parent_directory' and fix load-history
build-up with relative paths.
Diffstat (limited to 'src/lread.c')
-rw-r--r-- | src/lread.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/lread.c b/src/lread.c index 18a56d0969c..9bd60b9b386 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1102,6 +1102,14 @@ close_infile_unwind (void *arg) infile = prev_infile; } +static Lisp_Object +parent_directory (Lisp_Object directory) +{ + return Ffile_name_directory (Fsubstring (directory, + make_fixnum (0), + Fsub1 (Flength (directory)))); +} + DEFUN ("load", Fload, Sload, 1, 5, 0, doc: /* Execute a file of Lisp code named FILE. First try FILE with `.elc' appended, then try with `.el', then try @@ -1474,13 +1482,8 @@ Return t if the file exists and loads successfully. */) same folder of their respective sources therfore not to break packages we fake `load-file-name' here. The non faked version of it is `load-true-file-name'. */ - Lisp_Object dir = Ffile_name_directory (found); - Lisp_Object parent_dir = - Ffile_name_directory (Fsubstring (dir, - make_fixnum (0), - Fsub1 (Flength (dir)))); specbind (Qload_file_name, - concat2 (parent_dir, + concat2 (parent_directory (Ffile_name_directory (found)), Ffile_name_nondirectory (found))); } else @@ -1506,9 +1509,15 @@ Return t if the file exists and loads successfully. */) if (NATIVE_COMP_FLAG) { specbind (Qcurrent_load_list, Qnil); - LOADHIST_ATTACH (found); + if (!NILP (Vpurify_flag)) + { + Lisp_Object base = parent_directory (Ffile_name_directory (found)); + Lisp_Object offset = Flength (base); + hist_file_name = Fsubstring (found, offset, Qnil); + } + LOADHIST_ATTACH (hist_file_name); Fnative_elisp_load (found, Qnil); - build_load_history (found, true); + build_load_history (hist_file_name, true); } else /* This cannot happen. */ |