From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: C++ mode and c-beginning-of-current-token Date: Thu, 17 May 2007 10:32:38 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1179412522 32553 80.91.229.12 (17 May 2007 14:35:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 17 May 2007 14:35:22 +0000 (UTC) Cc: rudalics@gmx.at, acm@muc.de, emacs-devel@gnu.org, handa@m17n.org To: "Herbert Euler" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 17 16:35:20 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 1Hoh4U-00050G-DZ for ged-emacs-devel@m.gmane.org; Thu, 17 May 2007 16:35:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HohCa-0004ha-JI for ged-emacs-devel@m.gmane.org; Thu, 17 May 2007 10:43:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HohCH-0004ZV-2P for emacs-devel@gnu.org; Thu, 17 May 2007 10:43:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HohCG-0004ZB-Fv for emacs-devel@gnu.org; Thu, 17 May 2007 10:43:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HohCG-0004Z7-A5 for emacs-devel@gnu.org; Thu, 17 May 2007 10:43:16 -0400 Original-Received: from 18.red-83-50-230.dynamicip.rima-tde.net ([83.50.230.18] helo=alfajor.home) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Hoh3D-00062u-I7 for emacs-devel@gnu.org; Thu, 17 May 2007 10:34:53 -0400 Original-Received: by alfajor.home (Postfix, from userid 20848) id 45D071C14F; Thu, 17 May 2007 10:32:38 -0400 (EDT) In-Reply-To: (Herbert Euler's message of "Thu\, 17 May 2007 20\:52\:33 +0800") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (gnu/linux) X-detected-kernel: Linux 2.6 (newer, 3) 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:71250 Archived-At: > 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. The important part is to make sure that the syntax-table is up-to-date for the char being read, when to char is passed to `SYNTAX'. Also, it is important to update the syntax-table only after making sure that the new position is valid. So I believe the patch below is what we want. Stefan --- orig/src/syntax.c +++ mod/src/syntax.c @@ -1691,10 +1691,10 @@ p = GPT_ADDR; stop = endp; } + UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); if (! fastmap[(int) SYNTAX (p[-1])]) break; p--, pos--; - UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); } } }