0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

emacs: add lexical-binding: t to files, generated by emacs.pkgs.withPackages (#388407)

This commit is contained in:
Lin Jian 2025-03-10 19:56:23 +08:00 committed by GitHub
commit abd72d8e98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -164,6 +164,7 @@ runCommand (lib.appendToName "with-packages" emacs).name
# buffer.
rm -f $siteStart $siteStartByteCompiled $subdirs $subdirsByteCompiled
cat >"$siteStart" <<EOF
;;; -*- lexical-binding: t -*-
(let ((inhibit-message t))
(load "$emacs/share/emacs/site-lisp/site-start"))
;; "$out/share/emacs/site-lisp" is added to load-path in wrapper.sh
@ -175,11 +176,14 @@ runCommand (lib.appendToName "with-packages" emacs).name
EOF
# Generate a subdirs.el that statically adds all subdirectories to load-path.
cat >"$subdirs" <<EOF
;;; -*- lexical-binding: t -*-
EOF
$emacs/bin/emacs \
--batch \
--load ${./mk-wrapper-subdirs.el} \
--eval "(prin1 (macroexpand-1 '(mk-subdirs-expr \"$out/share/emacs/site-lisp\")))" \
> "$subdirs"
>> "$subdirs"
# Byte-compiling improves start-up time only slightly, but costs nothing.
$emacs/bin/emacs --batch -f batch-byte-compile "$siteStart" "$subdirs"