From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: exits funnel Newsgroups: gmane.emacs.help Subject: Re: Indenting in C++ Date: Sun, 26 Oct 2003 11:19:04 -0800 (PST) Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <20031026191904.47589.qmail@web40503.mail.yahoo.com> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1067196226 19711 80.91.224.253 (26 Oct 2003 19:23:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 26 Oct 2003 19:23:46 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 26 20:23:42 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ADqUI-0002vG-00 for ; Sun, 26 Oct 2003 20:23:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ADqQy-0005Sx-KL for geh-help-gnu-emacs@m.gmane.org; Sun, 26 Oct 2003 14:20:16 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1ADqQR-0005PU-TN for help-gnu-emacs@gnu.org; Sun, 26 Oct 2003 14:19:43 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1ADqPq-0005BM-Si for help-gnu-emacs@gnu.org; Sun, 26 Oct 2003 14:19:39 -0500 Original-Received: from [66.218.78.120] (helo=web40503.mail.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.24) id 1ADqPp-0005Av-T1 for help-gnu-emacs@gnu.org; Sun, 26 Oct 2003 14:19:05 -0500 Original-Received: from [67.86.87.9] by web40503.mail.yahoo.com via HTTP; Sun, 26 Oct 2003 11:19:04 PST Original-To: Alan Mackenzie , help-gnu-emacs@gnu.org In-Reply-To: X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13555 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13555 Thanks Alan! The documentation you pointed me towards was exactly what I was looking for. I was thrown off by the fact that it wasn't contained within the emacs docs but at a 'higher' info level. In any case, I've almost got my indentation working how I want it to, but I've run into one small snag. I'd like the following: (1)class foo (2){ (3) public: (4) void print1( ); (5)} (6)void foo::print1( ) (7){ (8) (9)} The changes I've made to my .emacs file include the following lines: (setq c-basic-offset 2) (c-set-offset 'inclass '+) (c-set-offset 'access-label 0) (c-set-offset 'topmost-intro '+) Life is good now in the example above except for line (6) which emacs is indenting 2 spaces when I'd like it not to be indented at all. This is happening, of course, because it identifies both lines syntactically as 'topmost-intro'. Does anyone have any suggestions then about how I can get emacs to distinguish between lines (4) and (6) so I can get it to indent them differently? Thank in advance. -exits --- Alan Mackenzie wrote: > exits funnel wrote on Sat, > 25 Oct 2003 13:45:18 > -0700 (PDT): > > Hello, > > > I've just started using emacs for C++ and I'm > trying > > to customize it to indent as follows: > > > class foo > > { > > public: > > void print1( ); > > > private: > > void print2( ); > > void print3( ); > > }; > > > I've spent most of the morning searching the web > to no avail. It's not > > that I can't find any information; rather that > I've found too much. > > I know that feeling _very_ well. You can spend days > searching through > reams of bumf, just to find those elusive few > paragraphs which explain > everything. > > > At this point I'm quite confused for example about > the difference > > between a 'mode' and a 'style.' > > A 'major mode' is something like C++ mode, or Text > mode. A 'minor mode' > is an add-on feature, like Font Lock mode (the thing > that does "syntax > highlighting"). Normally when people just say > "mode" they mean the major > mode. > > As you've probably gathered, C++ mode is one of a > family of modes > collectively known as "CC Mode", the others being > Java, C, Pike, .... > > The term 'style' is peculiar to CC mode, and it > refers mainly to the way > indentation gets done. For example, "GNU" style > (the default factory > setting) looks like this: > > if (a++ >= 5) > { > insert_blank_line () ; > a = 0 ; > } > > , whereas "Whitesmith" style would be > > if (a++ >= 5) > { > insert_blank_line () ; > a = 0 ; > } > > You might really be wanting "Stroustrup" style. > > > If anyone could point me towards a source of > information geared > > specifically towards modifying c++ formatting, I"d > be very grateful. > > The CC Mode manual is exactly what you need. It > ought to be installed on > your system already. Type "C-h i" (to get to Info), > followed by "d" (to > make sure you're already at the directory page), > followed by "m cc mode > " (which should get you to the manual). > > The top level menu there has an item "Customizing > Indentation", which is > what you're looking for. There is a page "Styles" > which tells you how to > set a style. It's not light bedtime reading by any > means, but the > information is all there. (If it's not, or you > can't figure something > out, please come back and tell us what's unclear, so > that we can fix > it!). > > All the best! > > > -exits > > -- > 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"). > > _______________________________________________ > Help-gnu-emacs mailing list > Help-gnu-emacs@gnu.org > http://mail.gnu.org/mailman/listinfo/help-gnu-emacs __________________________________ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/