Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

List all bindings in a keymap

8 views
Skip to first unread message

Dmitry Gutov

unread,
Sep 24, 2012, 8:01:44 AM9/24/12
to help-gn...@gnu.org
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


Dmitry Gutov

unread,
Sep 24, 2012, 8:09:03 PM9/24/12
to p...@informatimago.com, help-gn...@gnu.org
"Pascal J. Bourguignon" <p...@informatimago.com> writes:

> Dmitry Gutov <dgu...@yandex.ru> writes:
>> How do I do that, short of traversing the keymap structure manually?
>
> Check
>
https://gitorious.org/com-informatimago/emacs/blobs/blame/256fae6797241e707b3bc79cc7812a82074948a1/pjb-emacs.el#line1750

Thanks, but I got a simpler solution with `map-keymap' working, see:

https://github.com/dgutov/diff-hl/blob/a01d2917a07d91269c13901bb65fd7ef54766fd4/diff-hl.el#L327

0 new messages