I am creating a keymap based on a configuration file.
The resulting keys all call the same function but with different arguments.
Here is the code I am using for a single key:
(defun add-do-my-stuff-keybinding (config-pair)
"Add config to do-my-stuff-map"
(define-key do-my-stuff-map (kbd (config-get-key config-pair))
`(lambda ()
(interactive)
(do-stuff ,(config-get-name config-pair)))))
My question is, is there a way to avoid the lambda so that the inspection of the keybindings does not show a lambda but a helpful function name?
Something like generating defuns oder named lambdas?
defmacro
to define a macro returning a function generated from the config-file key + pair. The generated function could get a proper name and documentation string (using thedeclare
form) and then be used instead of the lambda.