From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.devel Subject: Re: Wrong comment in keymap.c Date: Mon, 26 Mar 2007 14:00:26 +0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1174888852 23970 80.91.229.12 (26 Mar 2007 06:00:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Mar 2007 06:00:52 +0000 (UTC) Cc: emacs-devel@gnu.org To: herberteuler@hotmail.com, monnier@iro.umontreal.ca Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 26 08:00:45 2007 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 1HViG3-0005n0-JB for ged-emacs-devel@m.gmane.org; Mon, 26 Mar 2007 08:00:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HViIF-00047h-Fs for ged-emacs-devel@m.gmane.org; Mon, 26 Mar 2007 01:02:59 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HViIB-000445-Qo for emacs-devel@gnu.org; Mon, 26 Mar 2007 02:02:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HViIA-00042O-EZ for emacs-devel@gnu.org; Mon, 26 Mar 2007 02:02:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HViIA-00042L-62 for emacs-devel@gnu.org; Mon, 26 Mar 2007 01:02:54 -0500 Original-Received: from bay0-omc1-s23.bay0.hotmail.com ([65.54.246.95]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HViFv-0005WR-UR for emacs-devel@gnu.org; Mon, 26 Mar 2007 02:00:36 -0400 Original-Received: from hotmail.com ([65.55.154.108]) by bay0-omc1-s23.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Sun, 25 Mar 2007 23:00:29 -0700 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 25 Mar 2007 23:00:29 -0700 Original-Received: from 65.55.154.123 by by143fd.bay143.hotmail.msn.com with HTTP; Mon, 26 Mar 2007 06:00:26 GMT X-Originating-IP: [216.145.54.158] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com In-Reply-To: X-OriginalArrivalTime: 26 Mar 2007 06:00:29.0522 (UTC) FILETIME=[0E962320:01C76F6C] X-detected-kernel: Windows 2000 SP4, XP SP1+ 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:68574 Archived-At: >>> > Here is another one, for `read_key_sequence' in keyboard.c. >>> > `first_binding' is always used with `submaps', shouldn't the >>> > comment for it be `submaps', rather than `defs'? >>> >>>No, the comment is correct. The "submaps[first_binding]" expressions are >>>used to check whether that first binding is a prefix or not. I.e. kind >>>of >>>like "KEYMAPP (defs[first_binding])". >>> >>>It's mostly set in follow_key: >>> >>> if (! NILP (defs[i])) >>> first_binding = i; >> >>Excuse me, but there are two ``first_binding''s in this file; I refered >>the one in ``read_key_sequence''. Please take a look at near line >>8996: >> >> /* Find an accurate initial value for first_binding. */ >> for (first_binding = 0; first_binding < nmaps; first_binding++) >> if (! NILP (submaps[first_binding])) >> break; > >I guess I know what you meant now. I was wrong. I'm sorry >for the patch of keyboard.c. And thank you for reviewing it. Wait, please read this again: if (! NILP (current[i])) { defs[i] = access_keymap (current[i], key, 1, 0, 1); if (! NILP (defs[i])) first_binding = i; } else defs[i] = Qnil; ``current[i]'' is firstly tested. The invocation of ``follow_key'' in ``read_key_sequence'' uses ``submaps'' as the actual value for ``current'', and ``first_binding'' is assigned to ``i'' because ``current[i]'' is not nil. So I think what ``first_binding'' means is the lowest ``i'' such that ``submaps[i]'' is non-nil. Regards, Guanpeng Xu _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/