From: Alan M. <ac...@mu...> - 2013-04-21 16:45:47
|
Hi, Dave. On Fri, Apr 19, 2013 at 03:53:18PM +0000, Steffen, David wrote: > Hi, > I'm running Gnu Emacs 24.2.1 on windows (i386-mingw-nt6.1.7601). The > code looks like this, indented as Emacs sees fit: > Screen_DONINFO::Screen_DONINFO() // line 45 > : current_proc_data(guiglobs::proc_status.get_data()), > hct_set(FALSE), > tbv_set(FALSE), > [...] > platelet_precount_value_btnface_last_keypad(0), // line 58 > tbv(0), // line 59 > Note the non-indent of the tbv initializer on line 60. On line 59, C-c > C-s shows((member-init-cont 1205) (that's the 'c' in the second line, ' > : current...') but on line 60, C-c C-s shows ((topmost-intro-cont > 1166)), where 1166 is the beginning of the first line. > This is very annoying. The code base has huge initialization lists, > and Emacs mis-indents most of them like this. > (This problem existed in the CC-mode that came with the distribution, > but persists with 5.32.3 which I just installed.) > Any help would be appreciated. Thanks. I'm guessing here, but I think it's triggered by the "tbv(0)," line being just over 500 characters (more precisely, 500 non-string, non-comment characters) from the beginning of the function (the constructor, here). This 500 is a limit to a backward search for "beginning-of-statement" invoked when CC Mode is checking for the "tbv(0)," having member-init-cont syntax. Without the limit, searches are potentially unbounded, and can cause a slow down in C++ mode when they fail. I think I'm going to have to rethink this bit of the code; you're not the first person to hit this problem. As a workaround, I suggest you find the "500" in the CC Mode source code and replace it by a more suitable bound - 5000, perhaps. The pertinent code is at (?near) line 9606 in cc-engine.el in Emacs-24.2. This file will be somewhere like C:\path\to\emacs\lisp\progmodes\cc-engine.el. The code looks like this: ;; CASE 5B: After a function header but before the body (or ;; the ending semicolon if there's no body). ((save-excursion (when (setq placeholder (c-just-after-func-arglist-p (max lim (c-determine-limit 500)))) <========= (setq tmp-pos (point)))) (cond After editing the file, byte-compile it, e.g. with M-x byte-compile-file and reload it with, e.g., M-x load-file. Please let me know whether this helps. If not, I'll need to dig further to find the cause. > Dave Steffen -- Alan Mackenzie (Nuremberg, Germany). |