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")

closed as unclear what you're asking by Tyler, Stefan, DoMiNeLa10 Mar 14 at 15:56

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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