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