emacs-devel
[Top][All Lists]
Advanced

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

Re: C++ mode and c-beginning-of-current-token


From: Herbert Euler
Subject: Re: C++ mode and c-beginning-of-current-token
Date: Thu, 17 May 2007 20:52:33 +0800

Please try the same thing with Emacs 22 started with
"--unibyte" argument.  The same error is signalled.

So, the bug has been in the original code of skip_chars
(where it handles a unibyte case) in Emacs 22.  Could
someone please fix it in Emacs 22?  Then, I'll do the same
fix on emacs-unicode-2.

FWIW, I couldn't find problems with the attached patch.


*** syntax.c    Wed Jan 17 09:31:10 2007
--- syntax.c    Thu May 17 11:15:42 2007
***************
*** 1672,1678 ****
                  if (! fastmap[(int) SYNTAX (p[-1])])
                    break;
                  p--, pos--;
!                 UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1);
                }
          }
        }
--- 1672,1678 ----
                  if (! fastmap[(int) SYNTAX (p[-1])])
                    break;
                  p--, pos--;
!                 UPDATE_SYNTAX_TABLE_BACKWARD (pos);
                }
          }
        }

Can I ask a silly question, too?  There are two "calling"s of
UPDATE_SYNTAX_TABLE_BACKWARD in `skip_chars', one with the "argument"
(pos), the other with (pos - 1).  To me, the second one does not look
like a typo, but a correct piece of code on purpose.  Yes, changing it
from (pos - 1) to (pos) works, but it seems to be dangerous to me.

UPDATE_SYNTAX_TABLE_BACKWARD also updates `gl_state' by setting its
members `forward_i' and `backward_i'.  Perhaps (pos - 1) is for
keeping these two members at right positions.  Different "argument"s
passed to UPDATE_SYNTAX_TABLE_BACKWARD sets the two intervals
differently.  There are still some details I did not make clear, so I
am still confused now.

Regards,
Guanpeng Xu

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.com/





reply via email to

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