Normalize keymap and menu commands

Apply same "km wrapper" and docstring to key and menu bindings.
This commit is contained in:
dickmao 2020-03-14 00:13:57 -04:00
parent b265205a57
commit 53ab1c34f3
2 changed files with 8 additions and 4 deletions

View file

@ -1107,10 +1107,11 @@ associated with current buffer (if any)."
but then describe-minor-mode unhelpfully shows ?? for the keymap commands.
Tried add-function: the &rest from :around is an emacs-25 compilation issue."
(let ((km (intern (concat (symbol-name defn) "-km"))))
`(if (functionp (quote ,defn))
(let ((km (intern (concat (symbol-name defn) "-km")))
(docstring (and (functionp defn) (ein:get-docstring defn))))
`(if ,docstring
(progn
(fset (quote ,km) (lambda () (interactive)
(fset (quote ,km) (lambda () ,docstring (interactive)
(condition-case err
(poly-ein-base (call-interactively (function ,defn)))
(cl-no-method (message "%s: no applicable method" (quote ,km)))

View file

@ -659,7 +659,10 @@ Use `ein:log' for debugging and logging."
(defun ein:generate-menu (list-name-callback)
(mapcar (lambda (name-callback)
(destructuring-bind (name callback &rest args) name-callback
`[,name ,callback :help ,(ein:get-docstring callback) ,@args]))
`[,name
,(let ((km (intern-soft (concat (symbol-name callback) "-km"))))
(if (commandp km) km callback))
:help ,(ein:get-docstring callback) ,@args]))
list-name-callback))
(defcustom ein:enable-gc-adjust t