help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Forcing C++ to reformat


From: Marco Gidde
Subject: Re: Forcing C++ to reformat
Date: 19 Dec 2003 08:14:35 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

exits funnel <address@hidden> writes:

> 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 probelm (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.

Two function come to my mind: c-indent-defun and
c-indent-line-or-region. The first one is very useful in your case
when bound to some key, for example C-c C-q. It reformats the function
you are in. In fact I use it all the time, not only when I mistyped
something, but also when I change the position of some if, switch or
what ever.


-- 
Marco Gidde


reply via email to

[Prev in Thread] Current Thread [Next in Thread]