From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Doug Lewan Newsgroups: gmane.emacs.help Subject: RE: List all bindings in a keymap Date: Mon, 24 Sep 2012 13:59:32 +0000 Message-ID: <155DEC68569B714B86C2C7075F5EDA9826900D0C@DAKIYA1.pegasus.local> References: <87txun8w9j.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1348495142 9920 80.91.229.3 (24 Sep 2012 13:59:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Sep 2012 13:59:02 +0000 (UTC) To: Dmitry Gutov , "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 24 15:59:07 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TG9Bi-00065N-Be for geh-help-gnu-emacs@m.gmane.org; Mon, 24 Sep 2012 15:59:06 +0200 Original-Received: from localhost ([::1]:44662 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TG9Bd-0006bv-MR for geh-help-gnu-emacs@m.gmane.org; Mon, 24 Sep 2012 09:59:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TG9BT-0006b9-R7 for help-gnu-emacs@gnu.org; Mon, 24 Sep 2012 09:58:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TG9BS-0005Pi-PI for help-gnu-emacs@gnu.org; Mon, 24 Sep 2012 09:58:51 -0400 Original-Received: from mailhost.shubertorg.com ([207.246.209.200]:18972 helo=webmail.shubertorg.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TG9BS-0005PE-LT for help-gnu-emacs@gnu.org; Mon, 24 Sep 2012 09:58:50 -0400 Original-Received: from dakiya1.pegasus.local ([::1]) by DAKIYA1.pegasus.local ([::1]) with mapi id 14.01.0339.001; Mon, 24 Sep 2012 09:59:32 -0400 Thread-Topic: List all bindings in a keymap Thread-Index: AQHNmkyNt0iZiWf3kUSB/XYlEMy+fJeZg7lA In-Reply-To: <87txun8w9j.fsf@yandex.ru> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.21.202] X-detected-operating-system: by eggs.gnu.org: Windows XP/2000 (RFC1323+, w+, tstamp-) X-Received-From: 207.246.209.200 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86892 Archived-At: 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 t= he cleanest way to examine all the bindings in a keymap." (info node "Scann= ing Keymaps".) While I'm hardly an expert on keymaps I would bet that that already recurse= s "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=3Dshubertticketing.com@gnu.org > [mailto:help-gnu-emacs-bounces+dougl=3Dshubertticketing.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 >=20 > Hi all, >=20 > How do I do that, short of traversing the keymap structure manually? >=20 > 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: >=20 > (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)) >=20 > (require 'js) > (scan-keymap js-mode-map) >=20 > --Dmitry >=20