emacs-devel
[Top][All Lists]
Advanced

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

new syntax.c bug? [Re: [cvs] bug in font-lock and/or shell-script-mode]


From: Karl Chen
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)

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 / address@hidden


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





reply via email to

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