From 4d3587c8d081fbca6028398c5f679fd314b95bf4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 22 Dec 2018 05:20:43 -0500 Subject: [PATCH] Fix void-variable list error in multi-state binds Caused by overzealous re-setting of a variable in a loop, when it should only be set once. --- core/core-keybinds.el | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/core/core-keybinds.el b/core/core-keybinds.el index 1e4e05db9..0a2ea8650 100644 --- a/core/core-keybinds.el +++ b/core/core-keybinds.el @@ -238,14 +238,17 @@ For example, :nvi will map to (list 'normal 'visual 'insert). See (when (or (memq 'global states) (null states)) (setq states (delq 'global states)) (push 'nil states)) - (dolist (state states) + (if (and (listp def) + (memq (car-safe (doom-unquote def)) '(:def :ignore :keymap))) + (setq def `(quote ,(plist-put (general--normalize-extended-def (doom-unquote def)) + :which-key desc))) (when desc - (setq def - (if (and (equal key "") - (null def)) - `(quote (nil :which-key ,desc)) - `(list ,@(plist-put (general--normalize-extended-def def) - :which-key desc))))) + (setq def `(list ,@(cond ((and (equal key "") + (null def)) + `(nil :which-key ,desc)) + ((plist-put (general--normalize-extended-def def) + :which-key desc))))))) + (dolist (state states) (push key (alist-get state doom--map-batch-forms)) (push def (alist-get state doom--map-batch-forms))))