From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Indenting in C++ Date: Sun, 26 Oct 2003 09:33:51 +0000 Organization: muc.de e.V. -- private internet access Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1067165265 335 80.91.224.253 (26 Oct 2003 10:47:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 26 Oct 2003 10:47:45 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 26 11:47:41 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 1ADiQu-0001E6-01 for ; Sun, 26 Oct 2003 11:47:40 +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 1ADiQQ-000701-Jj for geh-help-gnu-emacs@m.gmane.org; Sun, 26 Oct 2003 05:47:10 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!syros.belnet.be!news.belnet.be!uni-erlangen.de!news-nue1.dfn.de!news-mue1.dfn.de!newsfeed.stueberl.de!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 79 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1067164184 71782 193.149.49.134 (26 Oct 2003 10:29:44 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 26 Oct 2003 10:29:44 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:117617 Original-To: help-gnu-emacs@gnu.org 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:13549 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13549 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").