tags:

views:

826

answers:

2

I would like to have an .emacs setting so that tabs are always formed by consecutive spaces. Preferably in each possible mode. In other editors it never seemed a problem, but in .emacs I'm a bit stuck with the tabs I'm afraid.

+9  A: 

add this in your .emacs:

(setq-default indent-tabs-mode nil)

or you can define a before-save-hook that eliminate hard tabs

dfa
I don't know who voted you down, it works fine for me, at least in textmode, other modes I haven't tried. Tx.
Peter
down votes without explanation are pointless :)
dfa
+4  A: 

Also of use, M-x untabify, which will convert all the tabs into spaces in the current region. You can use this to get rid of the existing tabs in files you've edited before you had the indent-tabs-mode set properly.

C-x h                   (M-x mark-whole-buffer)
M-x untabify
Trey Jackson
+1 for usefull indeed,(although I used that exact combination of commands already :-))
Peter
+1, you can put these macros in a before-save-hook
dfa