emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Mysterious fontification/C++ context issue


From: Jan Djärv
Subject: Re: Mysterious fontification/C++ context issue
Date: Mon, 04 Dec 2006 14:16:46 +0100
User-agent: Thunderbird 1.5.0.8 (X11/20061107)



Tim Van Holder skrev:
For a few weeks now, I've had intermittent issues editing C++ code in
Emacs; I was hoping to find some minimal reproducible case, but have
been unable to do so.

The symptoms are that while editing a C++ source file (typically
happens when killing or yanking, but I think I've seen it happen
with regular editing), fontification of the currently visible buffer
contents will fail. Scrolling shows other parts of the buffer are still
fontified correctly.  All in all this is a minor inconvenience, but
more annoyingly, it also affects C++-mode when it comes to indentation:
TAB and the electric characters (comma, parens) throw a

  (scan-error Containing expression ends prematurely nnnn mmmm)

(with the range indicating the current function).  Sometimes scrolling
back and forth far enough resolves this, sometimes more drastic
measures are needed (font-lock-fontify-buffer tends to clear it up,
as does normal-mode).
I'm not sure where the problem lies -- could be a cc-mode issue, could
be a font-lock issue, could be something else -- so I'm afraid I
cannot be of much help.

I see this too a lot, even in plain C files. A backtrace when this happen looks like this:

Debugger entered--Lisp error: (scan-error "Containing expression ends prematurely" 107612 107612)
  scan-lists(107699 -1 0)
  forward-list(-1)
  backward-list(1)
  beginning-of-defun-raw(nil)
  beginning-of-defun()
  c-get-fallback-start-pos(108117)
  c-parse-state()
  c-electric-semi&comma(nil)
  call-interactively(c-electric-semi&comma)
  call-last-kbd-macro(nil kmacro-loop-setup-function)
  kmacro-call-macro(nil nil)
  kmacro-end-and-call-macro(nil)
  call-interactively(kmacro-end-and-call-macro)

Usually moving the cursor up a few lines, hitting tab to indent that line, and then move back to the offending line cures it.

        Jan D.




reply via email to

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