Merge pull request #141186 from rycee/emacs-wrapper-static-subdirs

emacs: resolve wrapper load-path at build time
This commit is contained in:
adisbladis 2021-11-29 16:21:52 -08:00 committed by GitHub
commit b14dde0fd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -0,0 +1,6 @@
(defmacro mk-subdirs-expr (path)
`(setq load-path
(delete-dups (append '(,path)
',(let ((default-directory path))
(normal-top-level-add-subdirs-to-load-path))
load-path))))

View file

@ -165,8 +165,13 @@ runCommand
(add-to-list 'native-comp-eln-load-path "$out/share/emacs/native-lisp/")
''}
EOF
# Link subdirs.el from the emacs distribution
ln -s $emacs/share/emacs/site-lisp/subdirs.el -T $subdirs
# Generate a subdirs.el that statically adds all subdirectories to load-path.
$emacs/bin/emacs \
--batch \
--load ${./mk-wrapper-subdirs.el} \
--eval "(prin1 (macroexpand-1 '(mk-subdirs-expr \"$out/share/emacs/site-lisp\")))" \
> "$subdirs"
# Byte-compiling improves start-up time only slightly, but costs nothing.
$emacs/bin/emacs --batch -f batch-byte-compile "$siteStart" "$subdirs"