all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "filebat Mark" <filebat.mark@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: ident the code
Date: Tue, 26 Aug 2008 22:35:51 +0800	[thread overview]
Message-ID: <b93cb5f30808260735p146e1901w72f53fdb13831f66@mail.gmail.com> (raw)
In-Reply-To: <87ljyka3kg.fsf@localhorst.mine.nu>

[-- Attachment #1: Type: text/plain, Size: 1710 bytes --]

to Peter:
I think our replace-regex doesn't work well.
1) Supposing a code line is "if(s!=0)", it will be changed into "if(s! =
0)". That's definitely not the thing we want. The same problem occurs for
"if (s==0)".
2) A line of "strcpy(str, "a=2")", will be changed into "strcpy(str, "a =
2").

So we should spend more effort to solve those problems.
-----------------------------------------------------------------------------------------------------------------------
To David:
Indent is quite a useful utility. Thanks very much for your suggestion!
There are still something that doesn't look good for me.
Such as, script1 will be changed to srcipt2.
script1

void test(char* str)
{
 int i;
i=    2;

strcpy(str,        "hello");
}

script2
void
test( char* str )
{
 int i;
 i = 2;

 strcpy(str, "hello");
}


But what I want is script3.
script3:
void test( char* str )
{
 int i;
 i = 2;
 strcpy(str, "hello");
}

-----------------------------------------------------------------------------------------------------------------------
I'am sorry to bother you guys. I just curious how skilled programmers indent
their codes, to make them look nice. They may have written tons of codes,
not only C/C++, but also java, python, whatever.


2008/8/26 David Hansen <david.hansen@gmx.net>

> On Mon, 25 Aug 2008 21:59:01 +0800 filebat Mark wrote:
>
> > I think maybe an elisp function can do this job. I am wondering how to
> find
> > this elisp code, cause I don't want to reinvent the wheel.
>
> Tried this?  It has tons of options.
>
> INDENT(1)
>
> NAME
>       indent  - changes the appearance of a C program by inserting or
>       deleting whitespace.
>
> David
>
>
>
>


-- 
Thanks & Regards

Denny Zhang

[-- Attachment #2: Type: text/html, Size: 2511 bytes --]

  reply	other threads:[~2008-08-26 14:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-25 13:59 ident the code filebat Mark
2008-08-25 23:45 ` Peter Dyballa
2008-08-26  2:54 ` David Hansen
2008-08-26 14:35   ` filebat Mark [this message]
2008-08-26 15:56     ` filebat Mark
     [not found]     ` <mailman.17594.1219766191.18990.help-gnu-emacs@gnu.org>
2008-08-26 16:10       ` Andreas Politz

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

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

  git send-email \
    --in-reply-to=b93cb5f30808260735p146e1901w72f53fdb13831f66@mail.gmail.com \
    --to=filebat.mark@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.