* 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
* how to use gud buffer together with io buffer?
2012-09-24 12:01 List all bindings in a keymap Dmitry Gutov
@ 2012-09-24 12:53 ` horse_rivers
2012-09-24 13:59 ` List all bindings in a keymap Doug Lewan
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: horse_rivers @ 2012-09-24 12:53 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 118 bytes --]
hi
set-use-separate-io-buffer is removed from emacs in my emacs release,so I get no idea for this
thanks!
[-- Attachment #2: Type: text/html, Size: 353 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: List all bindings in a keymap
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
2012-09-24 14:25 ` Dmitry Gutov
2012-09-24 14:22 ` Drew Adams
2012-09-24 21:13 ` Pascal J. Bourguignon
3 siblings, 1 reply; 8+ 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] 8+ messages in thread
* RE: List all bindings in a keymap
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:22 ` Drew Adams
2012-09-24 20:05 ` Dmitry Gutov
2012-09-24 21:13 ` Pascal J. Bourguignon
3 siblings, 1 reply; 8+ 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] 8+ messages in thread
* Re: List all bindings in a keymap
2012-09-24 12:01 List all bindings in a keymap Dmitry Gutov
` (2 preceding siblings ...)
2012-09-24 14:22 ` Drew Adams
@ 2012-09-24 21:13 ` Pascal J. Bourguignon
3 siblings, 0 replies; 8+ 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] 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).