[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrong comment in keymap.c

From: Herbert Euler
Subject: Re: Wrong comment in keymap.c
Date: Mon, 26 Mar 2007 14:00:26 +0800

> 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

 /* Find an accurate initial value for first_binding.  */
 for (first_binding = 0; first_binding < nmaps; first_binding++)
   if (! NILP (submaps[first_binding]))

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

Guanpeng Xu

Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]