emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/setup 92b35d374f 1/2: Make 'setup-bind' non-destructive


From: ELPA Syncer
Subject: [elpa] externals/setup 92b35d374f 1/2: Make 'setup-bind' non-destructive
Date: Thu, 15 Sep 2022 07:58:02 -0400 (EDT)

branch: externals/setup
commit 92b35d374f3dfed0ab3de1aaec818339336db8fc
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Make 'setup-bind' non-destructive
    
    As discussed in [0], there appears to be a subtle bug in the previous
    implementation, whereas this non-destructive variant doesn't.
    
    [0] 
https://lists.sr.ht/~pkal/public-inbox/%3CCAE-yPnk9O0pz7a%2BZsE2iV7s02kiBbckgMzi%3D1eWAKg0aNQjoTQ%40mail.gmail.com%3E
---
 setup.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/setup.el b/setup.el
index 00909be5ce..b1d183c307 100644
--- a/setup.el
+++ b/setup.el
@@ -313,15 +313,15 @@ Each entry in VARS is a list of the form (VAR VAL), 
comparable to
 `let'.  This macro makes sure that the BODY is expanded correctly
 so that it can make use of the new bindings in VARS."
   (declare (debug let) (indent 1))
-  ;; The macro modifies VARS in place, inserting unquotes in the right
-  ;; places to convert a `let'-formed list into a alist.  The unquoted
-  ;; values are then handled by the backquote inserted by the macro.
-  ;; The list this generates is destructively concatenated to the
-  ;; beginning of setup-ops, which is safe because backquoting expands
-  ;; to a new list allocation.
-  (dolist (var vars)
-    (setcdr var (list '\, (cadr var))))
-  `(let ((setup-opts (nconc ,(list '\` vars) setup-opts)))
+  `(let ((setup-opts (append
+                      (list
+                       ,@(mapcar
+                          (lambda (bind)
+                            (list 'cons
+                                  (list 'quote (car bind))
+                                  (cadr bind)))
+                          vars))
+                      setup-opts)))
      (setup-expand ,body)))
 
 (defun setup-quit (&optional return)



reply via email to

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