unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* new syntax.c bug? [Re: [cvs] bug in font-lock and/or shell-script-mode]
       [not found] <200211092219.gA9MJoo30267@rum.cs.yale.edu>
@ 2002-11-12  7:58 ` Karl Chen
  2002-11-12 19:48   ` Stefan Monnier
  2002-11-12 20:43   ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Karl Chen @ 2002-11-12  7:58 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: new syntax.c bug? [Re: [cvs] bug in font-lock and/or shell-script-mode]
  2002-11-12  7:58 ` new syntax.c bug? [Re: [cvs] bug in font-lock and/or shell-script-mode] Karl Chen
@ 2002-11-12 19:48   ` Stefan Monnier
  2002-11-12 20:43   ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2002-11-12 19:48 UTC (permalink / raw)
  Cc: Stefan Monnier, emacs-devel

> 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';
>   }
> }
> }

If you turn on font-lock, you'll indeed notice that there's something
fishy going on.  I'll take a look at it,


	Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: new syntax.c bug? [Re: [cvs] bug in font-lock and/or shell-script-mode]
  2002-11-12  7:58 ` new syntax.c bug? [Re: [cvs] bug in font-lock and/or shell-script-mode] Karl Chen
  2002-11-12 19:48   ` Stefan Monnier
@ 2002-11-12 20:43   ` Stefan Monnier
  2002-11-12 21:15     ` Karl Chen
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2002-11-12 20:43 UTC (permalink / raw)
  Cc: Stefan Monnier, emacs-devel

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

Yes, my previous fix was just bogus.  I didn't pay enough attention
to the rest of the code.  It's a good deal more nasty to "fix it right"
than I though.  So I installed a simple&effective fix instead.

Please check that the current code still fixes the problem you reported
before and that it also fixes this problem with cperl-mode.

Thanks for your help,


	Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: new syntax.c bug? [Re: [cvs] bug in font-lock and/or shell-script-mode]
  2002-11-12 20:43   ` Stefan Monnier
@ 2002-11-12 21:15     ` Karl Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Karl Chen @ 2002-11-12 21:15 UTC (permalink / raw)
  Cc: emacs-devel

Both problems seem to be fixed now.

Thanks,
Karl

-- 
Karl Chen / quarl@quarl.org


On Tue, 12 Nov 2002, Stefan Monnier wrote:

> > 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)
>
> Yes, my previous fix was just bogus.  I didn't pay enough attention
> to the rest of the code.  It's a good deal more nasty to "fix it right"
> than I though.  So I installed a simple&effective fix instead.
>
> Please check that the current code still fixes the problem you reported
> before and that it also fixes this problem with cperl-mode.
>
> Thanks for your help,
>
>
> 	Stefan
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-11-12 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200211092219.gA9MJoo30267@rum.cs.yale.edu>
2002-11-12  7:58 ` new syntax.c bug? [Re: [cvs] bug in font-lock and/or shell-script-mode] Karl Chen
2002-11-12 19:48   ` Stefan Monnier
2002-11-12 20:43   ` Stefan Monnier
2002-11-12 21:15     ` Karl Chen

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