* describe-bindings-in-map
@ 2007-11-23 0:20 Drew Adams
2007-11-28 12:20 ` describe-bindings-in-map Johan Bockgård
0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2007-11-23 0:20 UTC (permalink / raw)
To: Emacs-Devel
Any interest in adding something like this to Emacs?
I use it quite often, especially since I often work with
minibuffer keymaps, which are a bit less accessible than most.
(defun describe-bindings-in-map (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-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-bindings-in-map keymap)
(interactive-p))
(with-output-to-temp-buffer "*Help*"
(princ name) (terpri)
(princ (make-string (length name) ?-)) (terpri) (terpri)
(princ (substitute-command-keys (concat "\\{" name "}"))))))
[BTW, I would also be interested in a command that pretty-prints a keymap,
showing its tree structure (inheritance etc.) but with character values
replaced by their human-readable strings. I haven't coded that, but if
someone has, please send it along.]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: describe-bindings-in-map
2007-11-23 0:20 describe-bindings-in-map Drew Adams
@ 2007-11-28 12:20 ` Johan Bockgård
2007-11-28 17:21 ` describe-bindings-in-map Drew Adams
0 siblings, 1 reply; 3+ messages in thread
From: Johan Bockgård @ 2007-11-28 12:20 UTC (permalink / raw)
To: emacs-devel
"Drew Adams" <drew.adams@oracle.com> writes:
> 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)').
--
Johan Bockgård
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: describe-bindings-in-map
2007-11-28 12:20 ` describe-bindings-in-map Johan Bockgård
@ 2007-11-28 17:21 ` Drew Adams
0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2007-11-28 17:21 UTC (permalink / raw)
To: Johan "Bockgård", emacs-devel
> > 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 "}"))))))
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-11-28 17:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-23 0:20 describe-bindings-in-map Drew Adams
2007-11-28 12:20 ` describe-bindings-in-map Johan Bockgård
2007-11-28 17:21 ` describe-bindings-in-map Drew Adams
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.