views:

382

answers:

1

hi

I am looking for code beautifier for UNIX/emacs. I have looked at gnu indent, artistic style, however I need something a bit different. For example, I would like the following:

for( int x= 0;; ++ x) if(x) break; to be formatted as for (int x = 0; ; ++x) if (x) break;. As far as I can tell artistic style does not do that (correct me if I am wrong).

What can you recommend?

Thanks

edit

both, artistic style and indent remove whitespace. Here is a small interactive command to beautify region:

405 (defun my-emacs-command-beautify-region()
406   (interactive)
407   (let ((cmd "astyle"))
408   (shell-command-on-region (region-beginning) (region-end) cmd (current-buffer) t))
+1  A: 

Give UniversalIndentGUI ( http://universalindent.sourceforge.net/ ) a try. It's got a ton of options and runs on mac, windows, and linux.

Taybin
+1 for the link
neuro