T Smith <[EMAIL PROTECTED]> writes:
> My question is what commands will format the code to look nice? I
> know of the "indent" command but it only seems to do uniform indenting
> for all the code. What I am asking for is something that does the
> indenting and auto edits the code to make it look a little more
> pretty.
You want something specific, so you'll need to write specific emacs
lisp code to implement it.
> When i say "format" or "make it look pretty" I mean it does stuff
> like:
> Ex: Take a really long if statement expression and make it into 4
> lines instead of just one HUGE expression.
> Ex:
> if((expression[x][y]>work[x][y])||(expression[x+1][y]>work[x+1][y])||(
> expression[x][y+1]>work[x][y+1])||(expression[x][y-1]>work[x][y-1])||
> if (( expression[x-1][y] > work[x-1][y] )
> || ( expression[x+1][y] > work[x+1][y] )
> || ( expression[x][y+1] > work[x][y+1] )
> || ( expression[x][y-1] > work[x][y-1] ))
Beurk. What'd look "pretty" for me would be:
if((work[x][y]<expression[x][y])
||(work[x+1][y]<expression[x+1][y])
||(work[x][y+1]<expression[x][y+1])
||(work[x][y-1]<expression[x][y-1])){
See what I mean by "specific"...
So, you need to write (at least a partial) parser for C in emacs lisp,
matching C statements and expressions, and reformating them.
--
__Pascal Bourguignon__ http://www.informatimago.com/
The world will now reboot. don't bother saving your artefacts.
_______________________________________________
Help-gnu-emacs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs