From df361a5b5fdc307008106eea1288965339843da8 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Mon, 6 Jul 2026 20:24:32 +0800 Subject: [PATCH] emacs: fix site-start.el native compilation destination Previously, natively compiled site-start.el was put into a wrong place and Emacs could not find it at runtime. As a result, starting Emacs with an empty .emacs.d (--init-directory) created an *Async-native-compile-log* buffer showing: > Compiling /nix/store/jplfqmm84dmrfdlbq1qn4lz259av9lm7-emacs-30.2/share/emacs/site-lisp/site-start.el... The compiled start-start.el file was at .emacs.d/eln-cache/30.2-d829fb48/site-start-6352488c-77e47a63.eln. With this patch, Emacs can find the natively compiled site-start.el at runtime. So starting Emacs with an empty .emacs.d will not create an *Async-native-compile-log* buffer and .emacs.d/ remains empty. The correct destination is found from INSTALL of Emacs source code: > '/usr/local/lib/emacs/VERSION/native-lisp' holds the natively compiled > pre-loaded Emacs Lisp files. If the build used the > 'configure' option '--with-native-compilation=aot', then > this directory holds all natively compiled Lisp files. Also, the last item of native-comp-eln-load-path aligns with that. --- pkgs/applications/editors/emacs/make-emacs.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/applications/editors/emacs/make-emacs.nix b/pkgs/applications/editors/emacs/make-emacs.nix index 0a92e2cb11d9..1a650a3b2af6 100644 --- a/pkgs/applications/editors/emacs/make-emacs.nix +++ b/pkgs/applications/editors/emacs/make-emacs.nix @@ -466,9 +466,8 @@ stdenv.mkDerivation (finalAttrs: { | xargs -n $((1000/NIX_BUILD_CORES + 1)) -P $NIX_BUILD_CORES \ $out/bin/emacs --batch -l comp --eval "(while argv \ (comp-trampoline-compile (intern (pop argv))))" - mkdir -p $out/share/emacs/native-lisp $out/bin/emacs --batch \ - --eval "(add-to-list 'native-comp-eln-load-path \"$out/share/emacs/native-lisp\")" \ + --eval "(add-to-list 'native-comp-eln-load-path \"$out/lib/emacs/$siteVersionDir/native-lisp\")" \ -f batch-native-compile $out/share/emacs/site-lisp/site-start.el '';