emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

describe-bindings-in-map


From: Drew Adams
Subject: describe-bindings-in-map
Date: Thu, 22 Nov 2007 16:20:04 -0800

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.]






reply via email to

[Prev in Thread] Current Thread [Next in Thread]