Shiva Wu
Shiva Wu

Reputation: 1094

How to make emacs perform the same as other editors on tab character?

The TAB key in emacs is bound to indent-for-tab-command, but the indent itself converts all the tabs into spaces, which I didn't like because it's harder to locate character in the code and the code gets bigger.

I tried to use (setq-default indent-tabs-mode t), (setq tab-width 4) or (setq default-tab-width 4), none of the above works. Neither the width of \t character changes, nor the indent uses tabs instead of spaces. And 'M-x tabify' does not work either.

I searched for a long time but got nearly nothing. Any ideas?

Upvotes: 1

Views: 419

Answers (1)

Spike
Spike

Reputation: 302

It's your .emacs settings, if you don't have any special settings in your .emacs file, tab should be inserted by default.

;; This will force emacs to insert spaces instead of tabs
(setq-default indent-tabs-mode t)

This other two settings are not related.

Check emacswiki.org for any Emacs related questions.

Upvotes: 3

Related Questions