0
votes

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?

1
actaully there're different situation in different mode, I mainly tested on cc-mode and java-mode. Got it work already.Shiva Wu

1 Answers

3
votes

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.