From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Karl Chen Newsgroups: gmane.emacs.devel Subject: new syntax.c bug? [Re: [cvs] bug in font-lock and/or shell-script-mode] Date: Mon, 11 Nov 2002 23:58:43 -0800 (PST) Sender: emacs-devel-admin@gnu.org Message-ID: References: <200211092219.gA9MJoo30267@rum.cs.yale.edu> Reply-To: Karl Chen NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1037201016 19962 80.91.224.249 (13 Nov 2002 15:23:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 13 Nov 2002 15:23:36 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18BzCX-000476-00 for ; Wed, 13 Nov 2002 16:13:09 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18BzOU-00066k-01 for ; Wed, 13 Nov 2002 16:25:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18BWAe-0008IA-00; Tue, 12 Nov 2002 03:13:16 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18BVwm-0005WL-00 for emacs-devel@gnu.org; Tue, 12 Nov 2002 02:58:56 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18BVwg-0005KN-00 for emacs-devel@gnu.org; Tue, 12 Nov 2002 02:58:54 -0500 Original-Received: from hkn.eecs.berkeley.edu ([128.32.47.228]) by monty-python.gnu.org with esmtp (Exim 4.10) id 18BVwf-0005Ha-00 for emacs-devel@gnu.org; Tue, 12 Nov 2002 02:58:49 -0500 Original-Received: from quarl (helo=localhost) by hkn.eecs.berkeley.edu with local-esmtp id 18BVwZ-0005lt-00; Mon, 11 Nov 2002 23:58:43 -0800 Original-To: Stefan Monnier , In-Reply-To: <200211092219.gA9MJoo30267@rum.cs.yale.edu> Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:9334 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:9334 There's a new indenting bug in HEAD 2002-11-11. It happens in cperl-mode but it may be caused by Stefan Monnier's recent changes to syntax.c (because of my previous complaint) Synposis: emacs -q C-x C-f blah M-x cperl-mode (perl-mode doesn't have a problem with the following example) { { { s,[a],,; print 'zzz'; } } } (press TAB at each line) the "print 'zzz'" line should be indented the same as the "s,[a],," line but it indents one less block. -- Karl Chen / quarl@quarl.org On Sat, 9 Nov 2002, Stefan Monnier wrote: > > This bug exists in emacs HEAD 2002-11-08 and has for at least about a > > month, but does not exist in 21.2. > > > > SYnposis: > > > > emacs -q > > > > C-x C-f script.sh > > > > echo a#\* \* \* \* \) > > > > M-x font-lock-fontify-buffer > > > > M-x font-lock-fontify-buffer > > > > > > The first fontify works fine, but the second one emits an error "Point > > after end of properties". If the file was not modified (saved) before, > > this will also set the modified flag for no apparent reason. In my setup > > this causes very annoying behaviour with my global-font-lock, version > > control and after-rvert hooks. > > > > > > I don't know what exactly about that line with the backslashes screws up > > emacs' parser. For example removing one of the "\*" or changing the "\)" > > will get rid of the bug. The example line given is as much as I could > > reduce from a 'find' command line. This bug happens not unoften. > > > > Regardless of whether the line is correct shell syntax or not, emacs > > should not prevent you from fontifying or saving it. > > I don't quite understand how this bug works. The patch below seems > to fix it, but makes me wonder why the problem did not appear more often > (or even all the time). It seems to be much older than a month, > so it was probably hidden before. > > > Stefan > > > Index: src/syntax.c > =================================================================== > RCS file: /cvsroot/emacs/emacs/src/syntax.c,v > retrieving revision 1.157 > diff -u -r1.157 syntax.c > --- src/syntax.c 30 Oct 2002 19:17:31 -0000 1.157 > +++ src/syntax.c 9 Nov 2002 22:14:19 -0000 > @@ -2504,10 +2504,10 @@ > #define INC_FROM \ > do { prev_from = from; \ > prev_from_byte = from_byte; \ > + UPDATE_SYNTAX_TABLE_FORWARD (prev_from); \ > prev_from_syntax \ > = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte)); \ > INC_BOTH (from, from_byte); \ > - UPDATE_SYNTAX_TABLE_FORWARD (from); \ > } while (0) > > immediate_quit = 1; > @@ -2627,6 +2620,7 @@ > else if (from < end) > if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)) > if (c1 = FETCH_CHAR (from_byte), > + UPDATE_SYNTAX_TABLE_FORWARD (from_byte), > SYNTAX_COMSTART_SECOND (c1)) > /* Duplicate code to avoid a complex if-expression > which causes trouble for the SGI compiler. */ > >