[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: List all bindings in a keymap
From: |
Doug Lewan |
Subject: |
RE: List all bindings in a keymap |
Date: |
Mon, 24 Sep 2012 13:59:32 +0000 |
Dmitry,
1. diff-hl-mode-map doesn't seem to be defined.
2. You haven't passed a keymap to (map-keymap) (second arg).
3. According to the info documentation of (map-keymap): "This function is the
cleanest way to examine all the bindings in a keymap." (info node "Scanning
Keymaps".)
While I'm hardly an expert on keymaps I would bet that that already recurses
"in the right way". (That's my guess for "max-lisp-eval-depth exceeded".)
I hope this helps.
,Doug
> -----Original Message-----
> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of Dmitry Gutov
> Sent: Monday, 2012 September 24 08:02
> To: help-gnu-emacs@gnu.org
> Subject: List all bindings in a keymap
>
> 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
>