How do I create interactive lambda functions?
(use-package general
:ensure t
:config
(general-evil-setup t)
;;(setq general-default-keymaps 'evil-normal-state-map)
(general-define-key
:states '(normal motion emacs)
:prefix "SPC"
"l" '(:ignore t :which-key "Workspace")
"lc" '(perspeen-create-ws :which-key "Create workspace")
"l1" '((lambda () (interactive) (perspeen-goto-ws 1)) :which-key "Workspace 1")
"l2" '((lambda () (interactive) (perspeen-goto-ws 2)) :which-key "Workspace 2")
)
)
This works but isn't there a less vebose way?
I also tired funcall
and call-interactively
"l1" '((funcall perspeen-goto-ws '1) :which-key "Workspace 1")
But that doesn't seem to work
Another idea was to expand a macro but that also doesn't seem to work
(defmacro goto-ws (idx)
(lambda () (interactive) (perspeen-goto-ws idx)))
"l2" '((expand-macro '(goto-ws 2)) :which-key "Workspace 2")