tags:

views:

615

answers:

2

So I've started using emacs and I love it. However, I'm a tab person. Unless I'm working on a project that is already using spaces, I use tabs. I mostly do php and html work. I've got tabs in php working well. But I can't figure out how to have html mode use tabs instead of two spaces.

Here is what I have so far:

(setq c-default-style "python")
(setq-default c-basic-offset 4
        tab-width 4
        indent-tabs-mode t)

What can I set so that html mode will use tabs?

Edit: Using Emacs 22.3.1

+4  A: 
(add-hook 'html-mode-hook
          (lambda()
            (setq sgml-basic-offset 4)
            (setq indent-tabs-mode t)))
Sean Bright
Could I be doing something wrong? That code has no effect for me. Running Emacs 22.3.1 btw.
Echo
Are you using the html-mode that is shipped with emacs or a third party one?
Sean Bright
Just the default html-mode that is shipped with emacs.
Echo
Try with the edit I just made.
Sean Bright
Yup. It works now. Thanks for that.
Echo
A: 

actually, indent-tabs-mode should probably be t by default.

Try M-i, just for a lark. That should insert a tab character. It's not a GREAT Solution, but it might work in a pinch.

ALSO, how did you test for space vs tab? moving across it? or deleting it? you might have 'backward-delete-char-untabify' rearing it's head.

Brian Postow
Yup, I had already tried killing and reopening the buffer and restarting emacs.
Echo