Roy Smith <[EMAIL PROTECTED]> wrote on 30 Aug 2005 16:51:20 -0400: > I'm working on a project which uses a LOCK/END_LOCK macro pair for > mutex locking in C++ source files. A typical section of code would > look like:
> LOCK (myDataLock) > myData = foo; > END_LOCK > How can I convince the indenting engine to treat the LOCK and END_LOCK > lines as beginning and ending blocks? Only with braces: LOCK (MyDataLock) { myData = foo; } END_LOCK; (The semicolon ater END_LOCK will prevent the next statement being indented one level too many.) And if you use auto-newline, you might want to extend the functionality of c-snug-do-while so as to indent the LOCK construct like a do-while, as above. I know that's not quite what you're asking for. But what you're asking for isn't entirely reasonable; a macro in C or C++ can expand to absolutely _anything_. The CC Mode indentation engine works purely syntactically, i.e. according to what the source "looks like". If the indentation were to be extended to handle "common" macro expansions, it would add a whole new level of complexity. For a start, the indentation engine would have somehow to be told that LOCK should behave like an open brace and END_LOCK like a close brace. Would this be done by you setting a configuration variable, or would CC Mode be expected to scan #include files, parsing all the macros? (And if you're not sure just how complicated the indentation engine already is, take a glance at the function `c-guess-basic-syntax' in cc-engine.el.) The other thing is, do you really want your C++ code to look more like Pascal? ;-) > I'm running GNU Emacs 21.3.1. -- Alan Mackenzie (Munich, Germany) Email: [EMAIL PROTECTED]; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a"). _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs