* Re: List all bindings in a keymap
@ 2012-09-25 0:09 Dmitry Gutov
0 siblings, 0 replies; 7+ 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] 7+ messages in thread
* List all bindings in a keymap
@ 2012-09-24 12:01 Dmitry Gutov
2012-09-24 13:59 ` Doug Lewan
` (2 more replies)
0 siblings, 3 replies; 7+ 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] 7+ messages in thread
* RE: List all bindings in a keymap
2012-09-24 12:01 Dmitry Gutov
@ 2012-09-24 13:59 ` Doug Lewan
2012-09-24 14:25 ` Dmitry Gutov
2012-09-24 14:22 ` Drew Adams
2012-09-24 21:13 ` Pascal J. Bourguignon
2 siblings, 1 reply; 7+ messages in thread
From: Doug Lewan @ 2012-09-24 13:59 UTC (permalink / raw)
To: Dmitry Gutov, help-gnu-emacs@gnu.org
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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: List all bindings in a keymap
2012-09-24 12:01 Dmitry Gutov
2012-09-24 13:59 ` Doug Lewan
@ 2012-09-24 14:22 ` Drew Adams
2012-09-24 20:05 ` Dmitry Gutov
2012-09-24 21:13 ` Pascal J. Bourguignon
2 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2012-09-24 14:22 UTC (permalink / raw)
To: 'Dmitry Gutov', help-gnu-emacs
> How do I do that, short of traversing the keymap structure manually?
`describe-keymap', in help-fns+.el
http://www.emacswiki.org/emacs-en/download/help-fns%2b.el
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: List all bindings in a keymap
2012-09-24 12:01 Dmitry Gutov
2012-09-24 13:59 ` Doug Lewan
2012-09-24 14:22 ` Drew Adams
@ 2012-09-24 21:13 ` Pascal J. Bourguignon
2 siblings, 0 replies; 7+ messages in thread
From: Pascal J. Bourguignon @ 2012-09-24 21:13 UTC (permalink / raw)
To: help-gnu-emacs
Dmitry Gutov <dgutov@yandex.ru> writes:
> 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)
Check
https://gitorious.org/com-informatimago/emacs/blobs/blame/256fae6797241e707b3bc79cc7812a82074948a1/pjb-emacs.el#line1750
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-09-25 0:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-25 0:09 List all bindings in a keymap Dmitry Gutov
-- strict thread matches above, loose matches on Subject: below --
2012-09-24 12:01 Dmitry Gutov
2012-09-24 13:59 ` 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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.