[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm eebe61a2e4 1/4: Avoid creating a symbol and passing i
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm eebe61a2e4 1/4: Avoid creating a symbol and passing it as argument |
Date: |
Mon, 4 Jul 2022 14:58:37 -0400 (EDT) |
branch: elpa/helm
commit eebe61a2e40ebd503c9b4f630cdafd35b4f7bae7
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Avoid creating a symbol and passing it as argument
for the next closure, use instead (list nil) as argument and use its
car which we modify with setcar which is presumably more efficient.
Thanks Stefan Monnier for showing this.
---
helm-core.el | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/helm-core.el b/helm-core.el
index f328dfdb44..4f50881da4 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -97,9 +97,8 @@ Run each function in the FUNCTIONS list in turn when called
within
DELAY seconds."
(declare (indent 1))
(let ((funs functions)
- (iter (cl-gensym "helm-iter-key"))
+ (iter (list nil))
(timeout delay))
- (set iter nil)
(lambda ()
(interactive)
(helm-run-multi-key-command funs iter timeout))))
@@ -109,19 +108,19 @@ DELAY seconds."
(cl-loop for count from 1 to (length functions)
collect count)))
next)
- (unless (and (symbol-value iterator)
+ (unless (and (car iterator)
;; Reset iterator when another key is pressed.
(eq this-command real-last-command))
- (set iterator (helm-iter-list (funcall fn))))
- (setq next (helm-iter-next (symbol-value iterator)))
+ (setcar iterator (helm-iter-list (funcall fn))))
+ (setq next (helm-iter-next (car iterator)))
(unless next
- (set iterator (helm-iter-list (funcall fn)))
- (setq next (helm-iter-next (symbol-value iterator))))
- (and next (symbol-value iterator)
+ (setcar iterator (helm-iter-list (funcall fn)))
+ (setq next (helm-iter-next (car iterator))))
+ (and next (car iterator)
(call-interactively (nth (1- next) functions)))
(when delay (run-with-idle-timer
delay nil (lambda ()
- (set iterator nil))))))
+ (setcar iterator nil))))))
(helm-multi-key-defun helm-toggle-resplit-and-swap-windows
"Multi key command to re-split and swap Helm window.