unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Alan Mackenzie<none@example.invalid>
Subject: Re: Forcing C++ to reformat
Date: Fri, 19 Dec 2003 08:57:46 +0000	[thread overview]
Message-ID: <aieurb.6d.ln@acm.acm> (raw)
In-Reply-To: mailman.328.1071800109.868.help-gnu-emacs@gnu.org

exits funnel <exitsfunnel@yahoo.com> 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-<space> 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 <something> you can type
M-<something> 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").

  parent reply	other threads:[~2003-12-19  8:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.328.1071800109.868.help-gnu-emacs@gnu.org>
2003-12-19  4:30 ` Forcing C++ to reformat Harald Maier
2003-12-19  7:14 ` Marco Gidde
2003-12-19  8:57 ` Alan Mackenzie [this message]
2003-12-20 18:26   ` exits funnel
     [not found] <mailman.412.1071948489.868.help-gnu-emacs@gnu.org>
2003-12-20 20:39 ` Johan Bockgård
2003-12-19  1:12 exits funnel

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=aieurb.6d.ln@acm.acm \
    --to=none@example.invalid \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).