TABs or Spaces

No, I’m not going to relitigate one of our favorite holy wars. Really, I don’t care very much about the issue. Long ago, I arbitrarily settled on spaces but don’t have strong feelings one way or the other and would change in an instant if there were a good reason.

Still, lots of people do care and chansey97 over at the Emacs subreddit wants to know what people think. The main way you express your preference in Emacs is with the indent-tabs-mode variable. If it’s t TABs get used, otherwise only spaces are used. There are some finer adjustments possible but indent-tabs-mode is the important setting.

To my surprise, most of the respondents echoed my indifference. They basically said that they just want Emacs to do the right thing when they press the TAB key. That’s actually pretty reasonable because the major modes will do the right thing—or whatever you’ve configured—when you press TAB.

Happily, your choice doesn’t commit you to one or the other for every file. For example, I have an old file—dating from my Vim days—that has TAB delimited fields. At the top of that file I simply added

# -*- Mode: text; indent-tabs-mode: t -*-

and when I press TAB, an actual TAB character is inserted.

I don’t know what other editors do. I don’t even remember how Vim handles the situation. It’s enough to know that whatever your preference, Emacs has you covered.

This entry was posted in General and tagged . Bookmark the permalink.