[svlug] Tab width in emacs

Larry Colen lrc at red4est.com
Tue May 1 14:21:18 PDT 2007


Apart from the religious issue that hard tabs are supposed to be eight
spaces, I've got to deal with the fact that a previous programmer set
them to 4 in his editor.

It seems that in vi, you can tell vi the tab spacing by starting the
file with this comment:
/* vi: set ts=4 sw=4 : */

Unfortunately, my fingers know emacs. When I try to use vi (or vim) as
my editor, my productivity goes to hell because as bad as emacs is, at
least I know how to do most of the things I need to. One thing that I
don't seem to be having any luck with is resetting the tab spacing for
c files.

What I'd really like to be able to do is to have emacs read that vi
magic at the head of the file, and if it's there, set the tab spacing
to the specified. Does anyone know of any magic to do so? Or at least
something to put in my .emacs file that'll do the trick?

Alternatively, is there an emacs equivalent to the 
/* vi: set ts=4 sw=4 : */
magic that I can put in the files?


-- 
Software that holds your hand is one thing, software that holds your
hand and won't let go is really, really annoying.
Larry Colen             lrc at red4est.com            http://www.red4est.com/lrc




More information about the svlug mailing list