From 582178a9067c5a410e1aaa872e468c1f1f0f91cc Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Sun, 14 Aug 2022 13:13:17 +0200 Subject: [PATCH] [Emacs] Go back to while loop in `csetq` While more elegant, `cl-loop` has a heavier setup which can make it much slower than a while loop in the long run. --- org/config/emacs.org | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/org/config/emacs.org b/org/config/emacs.org index 0125ef9..5db7258 100644 --- a/org/config/emacs.org +++ b/org/config/emacs.org @@ -486,9 +486,14 @@ The return value of `csetq' is the value of the last VAL. ;; Check if we have an even number of arguments (when (= (mod (length forms) 2) 1) (signal 'wrong-number-of-arguments (list 'csetq (1+ (length forms))))) - ;; Transform FORMS into a list of pairs (FORM . VALUE) - `(progn ,@(cl-loop for (form value) on forms by 'cddr - collect `(customize-set-variable ',form ,value)))) + ;; Transform FORMS into a list of pairs (FORM . VALUE) + (let (sexps) + (while forms + (let ((form (pop forms)) + (value (pop forms))) + (push `(customize-set-variable ',form ,value) + sexps))) + `(progn ,@(nreverse sexps)))) #+end_src I first got inspired by [[https://oremacs.com/2015/01/17/setting-up-ediff/][this blog article]] (archived article, just in