From f9b1e548c95a115e2bb143d0f4b1632a600f32da Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Sat, 25 Jan 2025 01:14:08 -0300 Subject: [PATCH] profiles: emacs-subdirs: Avoid building circular lists. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to e9b13294700de7082ee23aa6e1c17b4a8c8828ec. If the EMACSNATIVELOADPATH environment variable (by mistake) has duplicated paths, Emacs fails to start up with a message along the lines of List contains a loop: ("$HOME/.guix-profile/lib/emacs/native-site-lisp" […] . #2) To prevent this issue in the face of possibly duplicated search path elements, use non-destructive methods where possible. * guix/profiles.scm (emacs-subdirs): Use 'append' rather than 'nconc'. Change-Id: If646b806f24666b5247850d30d2819c7482c130b Fixes: Emacs "List contains a loop" Signed-off-by: Liliana Marie Prikler --- guix/profiles.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index 87b9543ac0..fb4dbc5bd0 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -1230,8 +1230,12 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx." (setq native-comp-eln-load-path (mapcan (lambda (dir) (if (equal dir needle) - (nconc ',native-comp-dirs - (list dir)) + ;; Note: needle may be found + ;; multiple times, so don't use + ;; destructive procedures like + ;; nconc. + (append ',native-comp-dirs + (list dir)) (list dir))) native-comp-eln-load-path)))) port)