From: Alan M. <ac...@mu...> - 2013-04-15 17:38:10
|
Hi, Matteo, On Tue, Apr 09, 2013 at 01:55:08PM +0200, Matteo Settenvini wrote: > Emacs : GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) > of 2013-01-20 on trouble, modified by Debian > Package: CC Mode 5.32.3 (C++/la) > Buffer Style: bsd > c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-properties 1-bit) > After working a while in some C++ buffers, I get a wrong context for the > body function, which in turn results in wrong indentation > (obviously). This is very, very, very frustrating. In the CC Mode in Emacs 24.2.1, there were some bugs in the handling of the so called "state cache" (basically, a record of the positions of certain braces and parens). This displayed more or less the symptoms you are reporting, and is almost certainly the cause of this bug. > A solution is to close Emacs and open it again, but I'd rather not. Upgrading to Emacs 24.3 should solve this problem. If you don't want to do that, download the Mercurial head revision of CC Mode from SourceForge (see <http://cc-mode.sourceforge.net/hgaccess.php>), and use that. Alternatively, instead of closing Emacs, execute M-: (c-state-cache-init), which should clear the cache corruption. > >>>From what I can tell, the context of the first line in the function body > gets switched to topmost-intro, while it should be defun-block-intro. > I am not able to give the exact steps to reproduce this, except to note > that sometimes it happens when editing the function signature in a wrong > way (e.g. missing template parameters right brace), going into the > function body, indenting, going back to the signature, etc. Please let me know if one of the methods above doesn't help. Thanks! > Regards, > Matteo -- Alan Mackenzie (Nuremberg, Germany). |