about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLin Jian <me@linj.tech>2023-08-26 14:52:13 +0800
committerAnderson Torres <torres.anderson.85@protonmail.com>2023-08-28 15:46:04 +0000
commit7d4ea94d02670f7028168a00cd11d621048201c2 (patch)
treeb1246ec6d9cd00346b50a480b717d821bb448bd4
parent2d324ed8f96721b74c3a232ffd4bf5af1497405b (diff)
emacs: keep the default first writable native-comp-eln-load-path dir
Fixes https://github.com/NixOS/nixpkgs/issues/247804.
-rw-r--r--pkgs/applications/editors/emacs/site-start.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/applications/editors/emacs/site-start.el b/pkgs/applications/editors/emacs/site-start.el
index 731b42c637e1c..b0694a90af0ed 100644
--- a/pkgs/applications/editors/emacs/site-start.el
+++ b/pkgs/applications/editors/emacs/site-start.el
@@ -42,11 +42,17 @@ least specific (the system profile)"
 ;;; Set up native-comp load path.
 (when (featurep 'native-compile)
   ;; Append native-comp subdirectories from `NIX_PROFILES'.
+  ;; Emacs writes asynchronous native-compilation files to the first writable directory[1].
+  ;; At this time, (car native-comp-eln-load-path) is a writable one in `user-emacs-directory'[2].
+  ;; So we keep that one unchanged.
+  ;; [1]: info "(elisp) Native-Compilation Variables"
+  ;; [2]: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/startup.el?id=3685387e609753293c4518be75e77c659c3b2d8d#n601
   (setq native-comp-eln-load-path
-        (append (mapcar (lambda (profile-dir)
+        (append (list (car native-comp-eln-load-path))
+                (mapcar (lambda (profile-dir)
                           (concat profile-dir "/share/emacs/native-lisp/"))
                         (nix--profile-paths))
-                native-comp-eln-load-path)))
+                (cdr native-comp-eln-load-path))))
 
 ;;; Make `woman' find the man pages
 (defvar woman-manpath)