unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Doug Lewan <dougl@shubertticketing.com>
To: Dmitry Gutov <dgutov@yandex.ru>,
	"help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: List all bindings in a keymap
Date: Mon, 24 Sep 2012 13:59:32 +0000	[thread overview]
Message-ID: <155DEC68569B714B86C2C7075F5EDA9826900D0C@DAKIYA1.pegasus.local> (raw)
In-Reply-To: <87txun8w9j.fsf@yandex.ru>

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
> 




  parent reply	other threads:[~2012-09-24 13:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24 12:01 List all bindings in a keymap Dmitry Gutov
2012-09-24 12:53 ` how to use gud buffer together with io buffer? horse_rivers
2012-09-24 13:59 ` Doug Lewan [this message]
2012-09-24 14:25   ` List all bindings in a keymap Dmitry Gutov
2012-09-24 14:22 ` Drew Adams
2012-09-24 20:05   ` Dmitry Gutov
2012-09-24 21:13 ` Pascal J. Bourguignon
  -- strict thread matches above, loose matches on Subject: below --
2012-09-25  0:09 Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=155DEC68569B714B86C2C7075F5EDA9826900D0C@DAKIYA1.pegasus.local \
    --to=dougl@shubertticketing.com \
    --cc=dgutov@yandex.ru \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).