* code beautification
@ 2004-12-02 15:32 Thomas Ruschival
2004-12-02 16:27 ` Henrik S. Hansen
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Thomas Ruschival @ 2004-12-02 15:32 UTC (permalink / raw)
I got a lot of old code that was produced by some IDE.
the IDE used this indentation style
if(1>2)
{
printf("Hello World!");
}
I personally prefer the K&R c-style over this and furthermore I have the habit of putting curly braces after each if,for,while,do I don't like code like
if (2<3)
printf("hello world");
My problem is now I don't know how to build a regexp that works over several lines with backrefs.
The "missing" Curly Braces are not important but changing the syle would be nice.
Anyone an idea how to reformat code in that way?
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: code beautification
2004-12-02 15:32 code beautification Thomas Ruschival
@ 2004-12-02 16:27 ` Henrik S. Hansen
2004-12-02 22:27 ` Thomas Ruschival
2004-12-02 16:28 ` EScott
2004-12-02 23:09 ` Leonardo Boiko
2 siblings, 1 reply; 6+ messages in thread
From: Henrik S. Hansen @ 2004-12-02 16:27 UTC (permalink / raw)
Thomas Ruschival <t.ruschival@vivid-md.de> writes:
> Anyone an idea how to reformat code in that way?
What about indent? This is not an emacs program, though.
--
Henrik S. Hansen http://freecode.dk/~hsh/
Computer science (software engineering) student
Free Software Foundation member #1702 (http://member.fsf.org)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: code beautification
2004-12-02 15:32 code beautification Thomas Ruschival
2004-12-02 16:27 ` Henrik S. Hansen
@ 2004-12-02 16:28 ` EScott
2004-12-02 23:09 ` Leonardo Boiko
2 siblings, 0 replies; 6+ messages in thread
From: EScott @ 2004-12-02 16:28 UTC (permalink / raw)
Cc: help-gnu-emacs, help-gnu-emacs-bounces+escott=nyiso.com
[-- Attachment #1.1: Type: text/plain, Size: 884 bytes --]
help-gnu-emacs-bounces+escott=nyiso.com@gnu.org wrote on 12/02/2004
10:32:47 AM:
> I got a lot of old code that was produced by some IDE.
> the IDE used this indentation style
> if(1>2)
> {
> printf("Hello World!");
> }
>
> I personally prefer the K&R c-style over this and furthermore I have
> the habit of putting curly braces after each if,for,while,do I don't
> like code like
> if (2<3)
> printf("hello world");
>
> My problem is now I don't know how to build a regexp that works over
> several lines with backrefs.
>
> The "missing" Curly Braces are not important but changing the syle
> would be nice.
>
> Anyone an idea how to reformat code in that way?
>
> Thomas
M-x c-set-style
and choose K&R
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
[-- Attachment #1.2: Type: text/html, Size: 1278 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: code beautification
2004-12-02 15:32 code beautification Thomas Ruschival
2004-12-02 16:27 ` Henrik S. Hansen
2004-12-02 16:28 ` EScott
@ 2004-12-02 23:09 ` Leonardo Boiko
2 siblings, 0 replies; 6+ messages in thread
From: Leonardo Boiko @ 2004-12-02 23:09 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 618 bytes --]
Thomas Ruschival wrote:
> My problem is now I don't know how to build a regexp that works over
> several lines with backrefs.
It seems that you solved your problem using the indent(1) program, which
is nice. But if I want to do this kind of complex substitution in
Emacs, I use macros. If you're not familiar with them, I'd recommend
reading the relevant section of the manual. Emacs macros are really
easier than they sound, and very useful.
Also, consider learning some elisp. I find that a quick function in the
scratch buffer is sometimes the simplest way of accomplishing a task.
--
Leonardo Boiko
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <mailman.3121.1102005569.27204.help-gnu-emacs@gnu.org>]
end of thread, other threads:[~2004-12-02 23:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-02 15:32 code beautification Thomas Ruschival
2004-12-02 16:27 ` Henrik S. Hansen
2004-12-02 22:27 ` Thomas Ruschival
2004-12-02 16:28 ` EScott
2004-12-02 23:09 ` Leonardo Boiko
[not found] <mailman.3121.1102005569.27204.help-gnu-emacs@gnu.org>
2004-12-02 22:22 ` Thomas Ruschival
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).