[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY
From: |
Vedat Hallac |
Subject: |
Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY |
Date: |
Wed, 13 Apr 2005 18:03:51 +1000 |
User-agent: |
Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux)) |
On Tue, 12 Apr 2005 20:58:12 +0000, Alan Mackenzie wrote:
> You could actually configure CC Mode only to do auto-newline on certain
> types of brace. For example, on one of these braces, type <CR> before it
> to get it onto a line of its own. Then do C-c C-s to get its "syntactic
> context". You'll get back something like "((bracelist-open 1523))".
> Then make sure c-hanging-braces-alist looks something like this:
>
> (setq c-hanging-braces-alist '((bracelist-open)
> (bracelist-close)))
>
> This will stop auto-newlines going in in these particular circumstances.
> (Note: auto-newlines are put on all braces apart from those in the list.
> If you wanted an auto-newline only _after_ a statement-block `{' (say,
> for Kernighan & Ritchie formatting) you'd have something like this:
>
> (setq c-hanging-braces-alist '((bracelist-open)
> (bracelist-close)
> (substatement-open after)))
>
> ).
Thanks for the info. I'll do that and see how close I'll get to
perfection. Currently my environment suits me so well that I rarely do
hand formatting of code anymore. It is great to be able to just type in,
and see your code formatted exactly as you want. :-)
BTW, is there an easy way to distinguish between the bracelist-close of
the structure initializer from the bracelist-close of the array
initializer in an array of structure case? What I want is something like:
struct_type_t test[] = {
{ &var1, sizeof(var1) },
{ &var2, sizeof(var2) }
};
What you suggest would end up with
struct_type_t test[] = {
{ &var1, sizeof(var1) },
{ &var2, sizeof(var2) } };
Which requires one manual correction. :-)
Cheers,
vedat
- Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, Alan Mackenzie, 2005/04/08
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, MSR, 2005/04/08
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, William Hughes, 2005/04/08
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, Jonathan Arnold, 2005/04/08
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, Ben Pfaff, 2005/04/08
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, Aidan Kehoe, 2005/04/09
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, Eric Eide, 2005/04/10
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, Vedat Hallac, 2005/04/10
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, Klaus Zeitler, 2005/04/11
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, James, 2005/04/11
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, Robert Marshall, 2005/04/11
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, Jochen Küpper, 2005/04/11
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY, Greg Rowe, 2005/04/12
- Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY RESULTS, Alan Mackenzie, 2005/04/24