From: Kelly F. H. <kf...@mq...> - 2004-03-31 22:42:19
|
You can untabify a region with the untabify command (M-Xuntabify)..... --=20 Kelly F. Hickel Senior Software Architect MQSoftware, Inc 952.345.8677 kf...@mq... =20 > -----Original Message----- > From: Sean Luke [mailto:se...@cs...] > Sent: Wednesday, March 31, 2004 4:37 PM > To: bug...@gn... > Subject: indent doesn't remove tabs >=20 > I humbly apologize if this is a FAQ, though my cursory glance suggested > it was not. >=20 > I am trying to use indent-region to auto-indent a fair chunk (30K > lines) of Java code in various files. This code was created using a > variety of tools, some of which used spaces for indentation, some used > tabs. When emacs indents the code it _retains_ the tabs; as a result > some lines are indented with tabs, and some with spaces. On a number > of IDEs this comes out looking horrific. >=20 > As I was writing a short auto-indenter in my Makefile (which I include > at the end) I had hoped that if I did (setq indent-tabs-mode nil) this > would prevent this behavior. Alas, it does not. If emacs thinks the > line is already indented correctly, it does not replace the tabs with > spaces. It only replaces them if it needs to _reindent_ the line. > This behavior to me seems significantly broken. >=20 > How would one tell emacs, in a simple way, to always use spaces instead > of tabs when indenting, and even go to the trouble of replacing leading > whitespace with tabs, short of writing my own C hook? (I want people > to be able to use their own brace style). >=20 > Sean Luke > George Mason University >=20 >=20 > The Makefile autoindenter... >=20 > indent: > touch ${HOME}/.emacs > find . -name "*.java" -print -exec emacs --batch --load > ~/.emacs --eval=3D'(progn (find-file "{}") (mark-whole-buffer) (setq > indent-tabs-mode nil) (indent-region (point-min) (point-max) nil) > (save-buffer))' \; >=20 >=20 > ugly and slow, but it works! >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > = administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck |