Dear emacs helpers, Anyway, I have some code that I want to be formatted to all look the same. I opened a terminal and used: indent file.cpp It worked once on one specific file, but afterwards it always returned any other files that I tried with it. By ruined I mean it was all garbaled text with garbage and had these weird newline characters everywhere that ruined it! ------------------------------ ---------------------------------------- ******************************** 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. ************************** I know it sounds crazy that it worked once, but it did! I have the file and it looks really good! I wanted that same thing on the others but it ended up corrupting one of the files with all these "new line characters". I also want to just state for the record that I have searched the emacs functions a lot. And I searched google a lot. But I am still only a newbie to emacs so I really am kinda having trouble with finding any help. Thanks, Trevor 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] )) Ex: Take an expression that has no spaces at all and add the proper spaces to it. Ex: a+b becomes a + b Ex: for(inti=0;i<10;i++) for( int i = 0; i < 10; i++ ) Ex: inline void class::function() inline void class:function() -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -----------------reply by one guy---------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- In this case, I am not even sure that emacs is the right solution for you. There exists a standalone utility called "indent" which will do more of what you want. Some of your issues are style issues for which emacs's c-mode will not make modifications. My guess is that the reason it only worked once was that, on that occasion only, you had the whole buffer marked. It is also possible that you tried it on buffers for which emacs did not what language to format for. Another key word you might check into is "prettyprint". Regards, David V.