ve ar ve ar - 1 year ago 122
Ruby Question

How I can use tabs instead spaces for emacs ruby-mode?

I try to use tabs instead spaces in emacs with ruby-mode, but I can't do it. There is my fragment from my emacs dot-file

(setq-default indent-tabs-mode t)
(setq-default tab-width 2)

but it doesn't works, I guess this have trouble by reason ruby-mode. And how I can fix it?

sorry for my bad English

Answer Source

I don't write Ruby code, so don't know about the ruby-mode in particular. But it seem that you need to wrap your setting by a hook to the ruby-mode. How about trying this?

(add-hook 'ruby-mode-hook 
          (lambda ()
            (setq indent-tabs-mode)
            (setq tab-width 2)))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download