mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-05 11:49:37 +00:00
Merge pull request from Fuco1/special-form-desc
Add better descriptions for lambdas, closures, keymaps GitHub-reference: https://github.com/jwiegley/use-package/issues/89
This commit is contained in:
commit
e23bce4c2f
1 changed files with 18 additions and 3 deletions
|
@ -95,6 +95,11 @@
|
||||||
:type 'regexp
|
:type 'regexp
|
||||||
:group 'bind-key)
|
:group 'bind-key)
|
||||||
|
|
||||||
|
(defcustom bind-key-describe-special-forms nil
|
||||||
|
"If non-nil, extract docstrings from lambdas, closures and keymaps if possible."
|
||||||
|
:type 'boolean
|
||||||
|
:group 'bind-key)
|
||||||
|
|
||||||
;; Create override-global-mode to force key remappings
|
;; Create override-global-mode to force key remappings
|
||||||
|
|
||||||
(defvar override-global-map (make-keymap)
|
(defvar override-global-map (make-keymap)
|
||||||
|
@ -184,15 +189,25 @@ function symbol (unquoted)."
|
||||||
((listp elem)
|
((listp elem)
|
||||||
(cond
|
(cond
|
||||||
((eq 'lambda (car elem))
|
((eq 'lambda (car elem))
|
||||||
"#<lambda>")
|
(if (and bind-key-describe-special-forms
|
||||||
|
(stringp (nth 2 elem)))
|
||||||
|
(nth 2 elem)
|
||||||
|
"#<lambda>"))
|
||||||
((eq 'closure (car elem))
|
((eq 'closure (car elem))
|
||||||
"#<closure>")
|
(if (and bind-key-describe-special-forms
|
||||||
|
(stringp (nth 3 elem)))
|
||||||
|
(nth 3 elem)
|
||||||
|
"#<closure>"))
|
||||||
((eq 'keymap (car elem))
|
((eq 'keymap (car elem))
|
||||||
"#<keymap>")
|
"#<keymap>")
|
||||||
(t
|
(t
|
||||||
elem)))
|
elem)))
|
||||||
((keymapp elem)
|
((keymapp elem)
|
||||||
"#<keymap>")
|
(if (and bind-key-describe-special-forms
|
||||||
|
(symbolp elem)
|
||||||
|
(get elem 'variable-documentation))
|
||||||
|
(format "%s" (get elem 'variable-documentation))
|
||||||
|
"#<keymap>"))
|
||||||
((symbolp elem)
|
((symbolp elem)
|
||||||
elem)
|
elem)
|
||||||
(t
|
(t
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue