help-gnu-emacs
[Top][All Lists]
Advanced

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

List all bindings in a keymap


From: Dmitry Gutov
Subject: List all bindings in a keymap
Date: Mon, 24 Sep 2012 16:01:44 +0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (windows-nt)

Hi all,

How do I do that, short of traversing the keymap structure manually?

The doc recommends to use `map-keymap', but it doesn't exactly do what I
want, and if I try to use it recursively, it reliably blows up with
"max-lisp-eval-depth exceeded". Example snippet:

(defun scan-keymap (map)
  (map-keymap (lambda (event binding)
                (if (consp binding)
                    (progn (message "cdadr %s" (cdadr binding))
                           (scan-keymap (cdadr binding)))
                  (message "%s" binding))) diff-hl-mode-map))

(require 'js)
(scan-keymap js-mode-map)

--Dmitry




reply via email to

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