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: Forcing C++ to reformat Date: Fri, 19 Dec 2003 08:57:46 +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 1071855043 23189 80.91.224.253 (19 Dec 2003 17:30:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 19 Dec 2003 17:30:43 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 19 18:30:35 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 1AXOSQ-0001wv-00 for ; Fri, 19 Dec 2003 18:30:34 +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 1AXPPH-00035b-E2 for geh-help-gnu-emacs@m.gmane.org; Fri, 19 Dec 2003 13:31:23 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!nntp.cs.ubc.ca!skynet.be!fr.ip.ndsoftware.net!newsfeed.stueberl.de!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 36 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1071854260 57378 193.149.49.134 (19 Dec 2003 17:17:40 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 19 Dec 2003 17:17:40 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:119523 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:15463 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15463 exits funnel wrote on Thu, 18 Dec 2003 17:12:57 -0800 (PST): > I use emacs to edit C++ source files. I've modified cc mode to format > my code as I desire but I' run into a common problem. Let's say I'm > typing and I accidently forget to close a brace or a paren and then > continue on coding. The following code is (of course) formatted > correctly according to what I actually typed but incorrectly according > to what I meant to type :) Okay, so I discover the problem (say a > missing close paren after an argument list) and go back and fix it. > How can I force the buffer to be reformatted at this point? I hope > this makes sense as I'm not too hip to all the emacs lingo yet. Thanks > in advance for any replies. C-c C-q will reindent the current function. C-M-q will reindent the contents of a "sexp". (i.e., put point on an opening brace, and C-M-q will reindent the innards.) C-M-\ will reindent the current region. (The "region" is the bit of text between "point" (the cursor) and the "mark" (where you last typed C- or started a search, or ....... To find where the mark currently is, type C-x C-x. Then type C-x C-x again to get back. Lots of things set the mark in Emacs.) Hint: In a C++ buffer, type C-h m. This will give you a list of C++-specific commands. Wherever you see ESC you can type M- instead. > -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").