unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Herbert Euler" <herberteuler@hotmail.com>
To: herberteuler@hotmail.com, monnier@iro.umontreal.ca
Cc: emacs-devel@gnu.org
Subject: Re: Wrong comment in keymap.c
Date: Mon, 26 Mar 2007 14:00:26 +0800	[thread overview]
Message-ID: <BAY143-F281AA3AA437706D5D51366DA6F0@phx.gbl> (raw)
In-Reply-To: <BAY143-F68BA3583ADF30F96796E6DA6F0@phx.gbl>

>>> > 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/

      reply	other threads:[~2007-03-26  6:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-22 12:37 Wrong comment in keymap.c Herbert Euler
2007-03-23  1:25 ` Herbert Euler
2007-03-26  1:49   ` Stefan Monnier
2007-03-26  4:24     ` Herbert Euler
2007-03-26  5:50       ` Herbert Euler
2007-03-26  6:00         ` Herbert Euler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY143-F281AA3AA437706D5D51366DA6F0@phx.gbl \
    --to=herberteuler@hotmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).