From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vedat Hallac Newsgroups: gmane.emacs.help Subject: Re: Emacs CC Mode's auto-newline facility: INFORMAL SURVEY Date: Wed, 13 Apr 2005 18:03:51 +1000 Message-ID: References: <9on63d.36.ln@acm.acm> <4pch3d.i6.ln@acm.acm> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1113380151 22071 80.91.229.2 (13 Apr 2005 08:15:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Apr 2005 08:15:51 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 13 10:15:49 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DLd1t-0002Th-BB for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Apr 2005 10:15:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DLccD-0007OH-DL for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Apr 2005 03:48:50 -0400 User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux)) Original-Newsgroups: gnu.emacs.help Original-NNTP-Posting-Host: 60.240.151.55 X-Original-NNTP-Posting-Host: 60.240.151.55 Original-X-Trace: dnews.tpgi.com.au!tpg.com.au 1113379430 60.240.151.55 (13 Apr 2005 18:03:50 +1000) Original-Lines: 45 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed1.swip.net!swipnet!News-Peer-Europe!news-peer-europe.sprintlink.net!news.net.hanse.com!nntp.gblx.net!nntp3.phx1!dnews.tpgi.com.au!tpg.com.au!not-for-mail Original-Xref: shelby.stanford.edu gnu.emacs.help:130055 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:25620 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:25620 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 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