From f90d65e1492a67433270402551608b46b75fca32 Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Tue, 18 Feb 2014 13:40:25 +0100 Subject: [PATCH] Add better descriptions for lambdas, closures, keymaps --- lisp/use-package/bind-key.el | 21 ++++++++++++++++++--- 1 file 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)) - "#") + (if (and bind-key-describe-special-forms + (stringp (nth 2 elem))) + (nth 2 elem) + "#")) ((eq 'closure (car elem)) - "#") + (if (and bind-key-describe-special-forms + (stringp (nth 3 elem))) + (nth 3 elem) + "#")) ((eq 'keymap (car elem)) "#") (t elem))) ((keymapp elem) - "#") + (if (and bind-key-describe-special-forms + (symbolp elem) + (get elem 'variable-documentation)) + (format "%s" (get elem 'variable-documentation)) + "#")) ((symbolp elem) elem) (t -- 2.39.2