How do I create interactive lambda functions?

(use-package general
  :ensure t
  (general-evil-setup t)
  ;;(setq general-default-keymaps 'evil-normal-state-map)

   :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")
  • 1
    0. Your question is unclear. 1. Please try to remove everything from your question that is not strictly related. For example, if the question does not depend on use-package or on binding keys, remove such stuff. 2. Your macro does nothing, pretty much. A macro should generate code that then gets evaluated. 3. See the Elisp manual, node Using Interactive, to learn about interactive. – Drew Dec 24 '17 at 16:20
  • I found the solution I was looking for here: emacs.stackexchange.com/questions/17617/… – Xerus May 2 at 18:15