[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: describe-bindings-in-map
From: |
Drew Adams |
Subject: |
RE: describe-bindings-in-map |
Date: |
Wed, 28 Nov 2007 09:21:24 -0800 |
> > Any interest in adding something like this to Emacs?
>
> Yes. I have had (almost) this command in my .emacs for a long time. I
> prefer the name `describe-[key]map' though, and I think that it should
> also print the keymap's documentation (`(documentation-property keymap
> 'variable-documentation)').
Agreed on both counts:
(defun describe-keymap (keymap)
"Describe bindings in KEYMAP, a variable whose value is a keymap.
Completion is available for the keymap name."
(interactive
(list (intern
(completing-read
"Keymap: " obarray
(lambda (m) (and (boundp m) (keymapp (symbol-value m))))
t nil 'variable-name-history))))
(unless (and (symbolp keymap) (boundp keymap)
(keymapp (symbol-value keymap)))
(error "`%S' is not a keymapp" keymap))
(let ((name (symbol-name keymap)))
(help-setup-xref (list #'describe-keymap keymap)
(interactive-p))
(with-output-to-temp-buffer "*Help*"
(princ name) (terpri)
(princ (make-string (length name) ?-)) (terpri) (terpri)
(princ (documentation-property keymap 'variable-documentation))
(terpri) (terpri)
(princ (substitute-command-keys (concat "\\{" name "}"))))))