From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: A simple implementation of context-sensitive keys Date: Sat, 13 Sep 2008 09:28:14 +0200 Message-ID: <87prn8fqsx.fsf@thinkpad.tsdh.de> References: <87y72079mg.fsf@thinkpad.tsdh.de> <87d4jbg62j.fsf@thinkpad.tsdh.de> <48C92024.6080804@gmail.com> <48C921CB.3010700@gmail.com> <87hc8miwy0.fsf@thinkpad.tsdh.de> <48C981C6.9030201@gmail.com> <87abed97gl.fsf@thinkpad.tsdh.de> <48CA29A7.1040501@gmail.com> <87d4j9r90k.fsf@thinkpad.tsdh.de> <87wshhpcjr.fsf@thinkpad.tsdh.de> <48CAFF55.5040508@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1221291037 20845 80.91.229.12 (13 Sep 2008 07:30:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Sep 2008 07:30:37 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Lennart Borgman \(gmail\)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 13 09:31:32 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KePbQ-0007St-Ix for ged-emacs-devel@m.gmane.org; Sat, 13 Sep 2008 09:31:32 +0200 Original-Received: from localhost ([127.0.0.1]:57175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KePaQ-0002sc-0F for ged-emacs-devel@m.gmane.org; Sat, 13 Sep 2008 03:30:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KePaK-0002r9-Vb for emacs-devel@gnu.org; Sat, 13 Sep 2008 03:30:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KePaK-0002ow-52 for emacs-devel@gnu.org; Sat, 13 Sep 2008 03:30:24 -0400 Original-Received: from [199.232.76.173] (port=34247 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KePaJ-0002oS-Uu for emacs-devel@gnu.org; Sat, 13 Sep 2008 03:30:23 -0400 Original-Received: from out1.smtp.messagingengine.com ([66.111.4.25]:50356) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KePaJ-0005jp-Mh for emacs-devel@gnu.org; Sat, 13 Sep 2008 03:30:23 -0400 Original-Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 5C465160B1B; Sat, 13 Sep 2008 03:30:23 -0400 (EDT) Original-Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Sat, 13 Sep 2008 03:30:23 -0400 X-Sasl-enc: 8xfzqRo4HmMNbEB+nts0zno31y5fVEqKtMbQgl60ntLh 1221291022 Original-Received: from thinkpad.tsdh.de (p54AF2F95.dip0.t-ipconnect.de [84.175.47.149]) by mail.messagingengine.com (Postfix) with ESMTPA id 30D9D27D3F; Sat, 13 Sep 2008 03:30:21 -0400 (EDT) Mail-Followup-To: "Lennart Borgman \(gmail\)" , emacs-devel@gnu.org In-Reply-To: <48CAFF55.5040508@gmail.com> (Lennart Borgman's message of "Sat, 13 Sep 2008 01:46:29 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:103866 Archived-At: "Lennart Borgman (gmail)" writes: Hi Lennart, >> Here's a q&d implementation of what I thought should do the trick. >> It works for me, although only very briefly tested. >> >> --8<---------------cut here---------------start------------->8--- >> (defun find-key-commands (key) >> (let (list) >> (when overriding-terminal-local-map > > > Yes, the structure of the key binding search must be mirrored in the > routine. But the problem I tried to solve was rather to find the > keymap variable names. Ok, that's true. You either have the keymap variable name or the mode name. In most cases appending "-map" to the mode name makes the keymap name. And even it that fails for some modes, I thing something like TAB ist bound to `do-foo' in `foo-mode'. is not too bad. > You do not have those names available anywhere really. You have to > guess. Maybe an adapted version of `apropos-value' might do the trick. As it's now it's much too slow and fails with large keymaps cause it uses their printed representation as regexp (which gets too long then). The `apropos-value' we need can skip everything which is not a list whose car is 'keymap. And we don't need to use strings and regexp matching, but simply `eq'. > But combining the mirrored structure with the routine that guesses the > keymap variable name would be the best I think. Yeah, something like that. Bye, Tassilo -- * delYsid has mortgage, opportunity and penis in his score file. thats pretty effective against spam aren't you worried about missing opportunities to mortgage your penis?