help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY


From: Alan Mackenzie
Subject: Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY
Date: Tue, 12 Apr 2005 20:58:12 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

Vedat Hallac <vman@black.hole.com> wrote on Mon, 11 Apr 2005 07:22:18 +1000:
> On Fri, 08 Apr 2005 19:58:01 +0000, Alan Mackenzie wrote:

[ .... ]

>> o How often do you use C-c C-a (or even C-c C-t) to toggle
>>   auto-newline mode?
> Never in the last two years or so. But there are times when I should.
> Especially when typing in initializers for arrays of structures. I do
> not always want to see them formatted as C code, especially when they
> are short (pointer, length) pairs.

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)))

).  

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").



reply via email to

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