Subject: cc mode font-locking -vs- multi-line strings
From: Tom Tromey <[email-masked]>
To: [email-masked]
Date: Sun, 22 Feb 2009 11:28:07 -0700

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked] mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Save the attached file as "infcmd.c".  (It comes from GNU gdb.)
Run emacs -q
Visit infcmd.c
Use M-> to go to the end of the buffer.
Notice that the font-locking is incorrect.

For me, the code at the end of the buffer is fontified as a string,
whereas it is actually a mix of strings and code.  The badness starts
at line 2594.

I can work around the problem by removing a character (say, at the
start of line 2593) and then undoing.

FWIW, I checked out CVS Emacs and built it, and it exhibits this same bug.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/22.2/etc/DEBUG for instructions.

In GNU Emacs 22.2.1 (i386-redhat-linux-gnu, GTK+ Version 2.12.9)
 of 2008-05-23 on xenbuilder4.fedora.phx.redhat.com
Windowing system distributor `The X.Org Foundation', version 11.0.10500000
configured using `configure  '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-x-toolkit=gtk' '--with-sound' '--with-toolkit-scroll-bars' 'build_alias=i386-redhat-linux-gnu' 'host_alias=i386-redhat-linux-gnu' 'target_alias=i386-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  gnus-agent-mode: t
  compilation-in-progress: (gid)
  shell-dirtrack-mode: t
  gnus-undo-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-spelling-mode: t
  erc-truncate-mode: t
  erc-status-mode: t
  erc-services-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-readonly-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
SPC p r a c t i c e . C-p C-k M-q C-c C-c C-p M S-SPC 
M S-SPC q s C-u C-n SPC M-> Q y s C-z o M-v M-v M-v 
C-v C-v C-v M-> <switch-frame> <switch-frame> <f10> 
<f10> C-z o C-l C-u C-n C-u C-n SPC E q n n SPC 5 0 
<return> M-> q SPC M-> C-u C-p C-u C-p C-u C-u E q 
C-l C-u C-n C-u C-n C-u C-n n SPC 5 0 <return> M-> 
Q y n SPC M-> Q y n SPC 5 0 <return> M-> C-u C-p Q 
y s M-v M-v M-v C-u C-u C-p n n n n M-g M-g M-g M-g 
s C-u C-u C-p C-u C-p C-u C-p M-g M-g M-g M-g s C-z 
o <f10> <f10> <f10> <switch-frame> <switch-frame> <f10> 
<switch-frame> n n n C-l n n M-g M-g M-g M-g s n C-l 
M-g M-g M-g p SPC <return> M-> SPC SPC C-z o <f10> 
C-z o SPC SPC <backspace> SPC SPC SPC SPC SPC SPC SPC 
SPC q M-g M-g s C-z o <f10> <f10> C-z o n M-g M-g s 
SPC M-> E q SPC M-> q s <switch-frame> <f10> <f10> 
<f10> I SPC d o n ' t SPC k n o w <return> <f10> C-x 
b i n f r <tab> <return> M-> <f10> n i c e <return> 
<f10> C-x C-v <return> M-> M-v M-v M-v M-v M-v M-v 
M-v M-v M-v M-v M-v M-v M-v M-v M-v M-v M-v M-v M-v 
M-v M-v M-v M-v <f10> <f10> M-v M-v M-v M-v M-v M-v 
M-v M-v M-v M-v C-x b i n f c m d <tab> <return> M-> 
M-v C-x C-f C-g <switch-frame> M-x r e p o r t - e 
m <tab> b <tab> <return>

Recent messages:
Scoring...done
Generating summary...done
Mark set
Expiring articles...done
(No changes need to be saved)
Saving /home/tromey/.newsrc.eld...
Saving file /home/tromey/.newsrc.eld...
Wrote /home/tromey/.newsrc.eld
Saving /home/tromey/.newsrc.eld...done
Mark set [3 times]
Quit
Tom