unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* List all bindings in a keymap
@ 2012-09-24 12:01 Dmitry Gutov
  2012-09-24 12:53 ` how to use gud buffer together with io buffer? horse_rivers
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Dmitry Gutov @ 2012-09-24 12:01 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: List all bindings in a keymap
@ 2012-09-25  0:09 Dmitry Gutov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Gutov @ 2012-09-25  0:09 UTC (permalink / raw)
  To: pjb; +Cc: help-gnu-emacs

"Pascal J. Bourguignon" <pjb@informatimago.com> writes:

 > Dmitry Gutov <dgutov@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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-09-25  0:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` List all bindings in a keymap Doug Lewan
2012-09-24 14:25   ` 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

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