diff options
author | John Wiegley <johnw@newartisans.com> | 2014-02-18 16:36:01 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2014-02-18 16:36:01 -0600 |
commit | e23bce4c2f0c42390c9462d80792917e4372b06c (patch) | |
tree | 87d2eef39870fa0e048ccd2a3514a41d089a6c1f /lisp/use-package | |
parent | aec1268960ff1161d7339139ba6b88175bc6fd70 (diff) | |
parent | f90d65e1492a67433270402551608b46b75fca32 (diff) | |
download | emacs-e23bce4c2f0c42390c9462d80792917e4372b06c.tar.gz emacs-e23bce4c2f0c42390c9462d80792917e4372b06c.tar.bz2 emacs-e23bce4c2f0c42390c9462d80792917e4372b06c.zip |
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
Diffstat (limited to 'lisp/use-package')
-rw-r--r-- | lisp/use-package/bind-key.el | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lisp/use-package/bind-key.el b/lisp/use-package/bind-key.el index c15a4321ef9..a6bba121fe7 100644 --- a/lisp/use-package/bind-key.el +++ b/lisp/use-package/bind-key.el @@ -95,6 +95,11 @@ :type 'regexp :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 (defvar override-global-map (make-keymap) @@ -184,15 +189,25 @@ function symbol (unquoted)." ((listp elem) (cond ((eq 'lambda (car elem)) - "#<lambda>") + (if (and bind-key-describe-special-forms + (stringp (nth 2 elem))) + (nth 2 elem) + "#<lambda>")) ((eq 'closure (car elem)) - "#<closure>") + (if (and bind-key-describe-special-forms + (stringp (nth 3 elem))) + (nth 3 elem) + "#<closure>")) ((eq 'keymap (car elem)) "#<keymap>") (t 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) elem) (t |