bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67292: [PATCH v2 2/2] profiles: emacs-subdirs: Also expand native-co


From: Liliana Marie Prikler
Subject: bug#67292: [PATCH v2 2/2] profiles: emacs-subdirs: Also expand native-comp-eln-load-path.
Date: Fri, 20 Dec 2024 21:10:47 +0100

This patch ensures that the pinned natively compiled Emacs packages can
actually be found in the respective load path.  The rationale for expanding it
mimics the rationale previously applied to load-path for byte compilation: We
want to be able to `guix upgrade' emacs (or similar) without yanking compiled
packages from underneath.

* guix/profiles.scm (emacs-subdirs): Write an additional “line” of code to
deal with ‘native-comp-eln-load-path’.
---
 guix/profiles.scm | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index a28cf872cf..87b9543ac0 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1206,7 +1206,15 @@ (define* (emacs-subdirs manifest #:optional system)
                           (scandir dir (negate (cute member <> '("." 
"..")))))))
                   (filter file-exists?
                           (map (cute string-append <> "/share/emacs/site-lisp")
-                               '#$(manifest-inputs manifest))))))
+                               '#$(manifest-inputs manifest)))))
+                (native-comp-needle
+                 ;; Dynamically find native-site-lisp relative to profile.
+                 ;; We can not hard-code the path here, because the output
+                 ;; isn't known yet.
+                 '(expand-file-name "../../../lib/emacs/native-site-lisp"))
+                (native-comp-dirs
+                 (search-path-as-list '("lib/emacs/native-site-lisp")
+                                      '#$(manifest-inputs manifest))))
             (mkdir-p destdir)
             (with-directory-excursion destdir
               (call-with-output-file "subdirs.el"
@@ -1216,6 +1224,18 @@ (define* (emacs-subdirs manifest #:optional system)
                      (list ,@(delete-duplicates subdirs)))
                    port)
                   (newline port)
+                  (write
+                   `(when (boundp 'native-comp-eln-load-path)
+                      (let ((needle ,native-comp-needle))
+                        (setq native-comp-eln-load-path
+                              (mapcan (lambda (dir)
+                                        (if (equal dir needle)
+                                            (nconc ',native-comp-dirs
+                                                   (list dir))
+                                            (list dir)))
+                                      native-comp-eln-load-path))))
+                   port)
+                  (newline port)
                   #t)))))))
   (gexp->derivation "emacs-subdirs" build
                     #:system system
-- 
2.46.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]