Subject: 23.1.91; error in c++-mode highlighting/indentation

From: Jose Antonio Ortega Ruiz <[email-masked]>
Date: Sun, 10 Jan 2010 15:18:27 +0100

Hi, this is a bugs somewhere in c-mode syntactic analyser (or so it
seems). It happens to me in several circumstances; below i describe a
simple instance for a C++ file (i've seen it happening also in pure C
files).

1) Start emacs with -nw and -Q
2) Create a new C++ file, say test.cpp
3) Insert the following text:

/* Copyright (C) 2009, 2100 Foo Industries */

#include <libPlasma/c++/Pool.h>

4) When pressing the closing '>' an error occurs with the following
backtrace:

Debugger entered--Lisp error: (args-out-of-range 79 80)
  put-text-property(79 80 category c-cpp-delimiter)
  byte-code("\306 \307\211\307\310\211\310\211
\310\311\216\312\211T\313\314$\210)\312\211T\313\314$\210.\310\207" [modified buffer-undo-list inhibit-read-only inhibit-point-motion-hooks before-change-functions after-change-functions buffer-modified-p t nil ((byte-code "\204
\301 \203
\302\303!\210\303\207" [modified buffer-modified-p set-buffer-modified-p nil] 2)) put-text-property category c-cpp-delimiter deactivate-mark buffer-file-name buffer-file-truename here-cpp-beg -pos- here-cpp-end] 6)
  top-level()
  call-interactively(top-level nil nil)
  recursive-edit()
  byte-code("\306	@\307=\203!\310\311\312\"\210\313\311!\211A@)\242\314=\203!\310\315\312\"\210\316!\210\317 \210\320	!\210\f\203d\321ed\"
V\203Web\210\322
\245y\210`db\210\322
\245
Zy\210`|\210)\323c\210eb\210\324\325\326 \"\210\327\306!\210\324\330!\210\331\312\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
  debug(error (args-out-of-range 79 80))
  remove-text-properties(79 80 (category nil))
  c-parse-state()
  c-syntactic-skip-backward("^<;}" nil t)
  c-electric-lt-gt(nil)
  call-interactively(c-electric-lt-gt nil nil)

In GNU Emacs 23.1.91.1 (i486-pc-linux-gnu, GTK+ Version 2.18.5)
 of 2010-01-06 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20100106-1)
configured using `configure  '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.1.91/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1.91/site-lisp:/usr/share/emacs/site-lisp' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

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
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: C++/l

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
C-x C-f t m p / i n d e n x DEL t - b u g DEL DEL DEL 
DEL DEL DEL DEL DEL DEL DEL c p p - DEL DEL DEL m o 
d e . c p p RET C-y / * SPC C o p y r i g h t SPC ( 
C ) SPC 2 0 0 9 , SPC 2 0 1 0 SPC O b l o n g SPC I 
n d u s t r i e s SPC * / RET RET RET # DEL # i n c 
l u e d e DEL DEL DEL C-a C-k C-p C-p C-p C-k / * SPC 
C o p y r i g h t SPC ( c ) DEL DEL C ) SPC 2 0 0 9 
, SPC 2 1 0 0 SPC F o o SPC I n d u s t r i e s SPC 
* / RET RET # i n c l u d e SPC < l i b P l a s m a 
/ c + + / P o o l . h > ESC x c - m o TAB TAB - r TAB 
DEL DEL DEL DEL DEL DEL DEL DEL r e p o TAB t TAB DEL 
r TAB RET

Recent messages:
("emacs")
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
Mark set
current-kill: Kill ring is empty
c-neutralize-syntax-in-and-mark-CPP: Args out of range: 53, 54Error during redisplay: (args-out-of-range 58 59)
byte-code: Args out of range: 79, 80
Auto-saving...
Making completion list...

Load-path shadows:
/usr/share/emacs/23.1.91/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/23.1.91/site-lisp/ruby1.8-elisp/ruby-mode hides /usr/share/emacs/23.1.91/lisp/progmodes/ruby-mode
/usr/share/emacs/23.1.91/site-lisp/prolog-el/prolog hides /usr/share/emacs/23.1.91/lisp/progmodes/prolog

Features:
(shadow sort mail-extr message sendmail ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc
time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1
hex-util hashcash mail-utils emacsbug help-mode view cc-mode cc-fonts
easymenu cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
regexp-opt tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win
x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode register
page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind font-render-setting gtk
x-toolkit x multi-tty emacs)