all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vedat Hallac <vman@black.hole.com>
Subject: Re: Emacs CC Mode's auto-newline facility:  INFORMAL SURVEY
Date: Wed, 13 Apr 2005 18:03:51 +1000	[thread overview]
Message-ID: <pan.2005.04.13.08.03.51.270682@black.hole.com> (raw)
In-Reply-To: 4pch3d.i6.ln@acm.acm

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

  reply	other threads:[~2005-04-13  8:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-08 19:58 Emacs CC Mode's auto-newline facility: INFORMAL SURVEY Alan Mackenzie
2005-04-08 20:18 ` MSR
2005-04-08 20:31 ` William Hughes
2005-04-08 21:38 ` Aidan Kehoe
2005-04-08 22:11 ` Jonathan Arnold
2005-04-08 22:13 ` Ben Pfaff
2005-04-10 18:34 ` Eric Eide
2005-04-10 21:22 ` Vedat Hallac
2005-04-12 20:58   ` Alan Mackenzie
2005-04-13  8:03     ` Vedat Hallac [this message]
2005-04-11  6:39 ` Klaus Zeitler
2005-04-11 10:19 ` James
2005-04-12 21:12   ` Alan Mackenzie
2005-04-11 17:52 ` Robert Marshall
     [not found] ` <9on63d.36.ln-Yd3Idk226uQ@public.gmane.org>
2005-04-11 20:51   ` Jochen Küpper
2005-04-12 11:47 ` Greg Rowe
2005-04-24 16:42 ` Emacs CC Mode's auto-newline facility: INFORMAL SURVEY RESULTS Alan Mackenzie
2005-04-25  2:37   ` Miles Bader
2005-04-25  8:21   ` Chris Croughton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pan.2005.04.13.08.03.51.270682@black.hole.com \
    --to=vman@black.hole.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.