From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: Function for deleting a key binding in a sparse keymap Date: Fri, 09 Dec 2005 21:12:40 +0100 Message-ID: <4399E538.2080909@student.lu.se> References: <3cc04a73cc1b1a.3cc1b1a3cc04a7@net.lu.se> <43987D21.4070200@student.lu.se> <4398C8F2.8060301@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1134161700 4988 80.91.229.2 (9 Dec 2005 20:55:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 9 Dec 2005 20:55:00 +0000 (UTC) Cc: emacs-devel@gnu.org, monnier@iro.umontreal.ca, storm@cua.dk Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 09 21:54:48 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EkpF0-0001Gc-IS for ged-emacs-devel@m.gmane.org; Fri, 09 Dec 2005 21:53:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EkpFM-0002xQ-08 for ged-emacs-devel@m.gmane.org; Fri, 09 Dec 2005 15:53:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EkocL-0001kp-As for emacs-devel@gnu.org; Fri, 09 Dec 2005 15:13:21 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EkocJ-0001jB-HW for emacs-devel@gnu.org; Fri, 09 Dec 2005 15:13:20 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EkocI-0001if-VP for emacs-devel@gnu.org; Fri, 09 Dec 2005 15:13:19 -0500 Original-Received: from [81.228.11.98] (helo=pne-smtpout1-sn1.fre.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EkodL-0001ZA-K6; Fri, 09 Dec 2005 15:14:23 -0500 Original-Received: from [192.168.123.121] (83.249.218.244) by pne-smtpout1-sn1.fre.skanova.net (7.2.060.1) id 4396EEA4000C4515; Fri, 9 Dec 2005 21:12:41 +0100 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: rms@gnu.org In-Reply-To: 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:47340 Archived-At: Richard M. Stallman wrote: > ***************************************************************************** > How to find the keymap for a given key sequence in a buffer > =========================================================== > >It would be good to put this list into the Active Keymaps node >in lispref/keymaps.texi. > > I am glad you appreciate it. However there was a bit more to add. I got some tips from Kim and made a new version. There is a question in this about when the keymap entry is a keymap. ********************************************************************************* ***************************************************************************** How to find the keymap for a given key sequence in a buffer =========================================================== Go through the list below step by step. As soon as a hit is found in any keymap (see KeyLookup) you normally are ready. However if the keymap entry is a variable symbol or a string then you must restart with the variable symbol value or the string from FIRST-MAP. The keymap entry could also be a keymap. In that case the next event is looked up in that keymap. (But what happens if there is no hit there, I can not find any documentation on this???) Note: When you finally find a function symbol through this process you must also check for command remapping. This just replaces the function symbol with another. It is not recursive. *) First apply `extra-keyboard-modifiers' mask to each keyboard character read. *) Each character read from the keyboard may be translated according to `keyboard-translate-table'. *) Characters that are self-inserting are translated according to `translation-table-for-input'. If a character is self-inserting then you are ready. *) Translate meta characters according to `meta-prefix-char' to a two character sequence. FIRST-MAP) Look in `special-event-map'. *) If using `read-from-minibuffer' (directly or indirectly) then look in the keymap given as parameter then look in this. Otherwise look in `minibuffer-local-map'. *) If using `read-no-blanks-input' to read from minibuffer then look in `minibuffer-local-ns-map' first and then `minibuffer-local-map'. *) If overriding-terminal-local-map look in this. Then go to GLOBAL. *) If overriding-local-map look in this. Then go to GLOBAL. *) Is there a "keymap" property of the text or overlay at point? *) Look for minor mode keymaps in `emulation-mode-map-alists'. *) Look for minor mode keymaps in `minor-mode-overriding-map-alist' *) Look for minor mode keymaps in `minor-mode-map-alist'. *) Is there a `local-map' property of the text or overlay at point? *) Is there a "local keymap" (those are for major modes)? GLOBAL) Look in the "current global keymap". (This is returned by `current-global-map' and may be different from `global-map', see `use-global-map'.) *) If it is an ASCII function key sequences then look in function-key-map. This map transforms to Emacs key sequences. *) The possibly transformed sequence after applying `function-key-map' is now handled to `key-translation-map' which works the same way. *) If any transformation was made by `function-key-map' or `key-translation-map' then take the new sequence and go back to FIRST-MAP. Note: You may also find the function `current-active-maps' useful.