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

From: Alan Mackenzie <[email-masked]>
Date: Wed, 20 Jan 2010 13:03:59 +0000

Hi, Jose,

On Sun, Jan 10, 2010 at 03:18:27PM +0100, Jose Antonio Ortega Ruiz wrote:

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

I've just committed a patch which I think fixes this.  Either update your
bzr version of Emacs, or apply the following patch (and then byte-compile
cc-langs.el, cc-engine.el, and cc-mode.el):

*** cc-defs.el~	2010-01-19 13:24:48.000000000 +0000
--- cc-defs.el	2010-01-19 17:23:44.000000000 +0000
***************
*** 1217,1228 ****
    ;; This macro does a hidden buffer change.
    `(progn
       (c-put-char-property ,beg 'category 'c-cpp-delimiter)
!      (c-put-char-property ,end 'category 'c-cpp-delimiter)))
  (defmacro c-clear-cpp-delimiters (beg end)
    ;; This macro does a hidden buffer change.
    `(progn
       (c-clear-char-property ,beg 'category)
!      (c-clear-char-property ,end 'category)))
  
  (defsubst c-comment-out-cpps ()
    ;; Render all preprocessor constructs syntactically commented out.
--- 1217,1230 ----
    ;; This macro does a hidden buffer change.
    `(progn
       (c-put-char-property ,beg 'category 'c-cpp-delimiter)
!      (if (< ,end (point-max))
! 	 (c-put-char-property ,end 'category 'c-cpp-delimiter))))
  (defmacro c-clear-cpp-delimiters (beg end)
    ;; This macro does a hidden buffer change.
    `(progn
       (c-clear-char-property ,beg 'category)
!      (if (< ,end (point-max))
! 	 (c-clear-char-property ,end 'category))))
  
  (defsubst c-comment-out-cpps ()
    ;; Render all preprocessor constructs syntactically commented out.

-- 
Alan Mackenzie (Nuremberg, Germany).