1

I've setup the indentation for tabs in Rust to be 2 whitespaces. That's what I want. And in my config it looks like this:

(add-hook 'rust-mode-hook
  (lambda ()
    (setq indent-tabs-mode nil)
    (setq tab-width 2)
    (setq rust-indent-offset 2)))

What's the difference between tab-width and rust-indent-offset or <lang>-indent-offset?

1

tab-width is the width used to display a TAB character. It also has an effect when indent-tabs-mode is non-nil, in which case Emacs uses tab-width to decide when to replace so many spaces with one TAB.

ruby-indent-offset and similar variables control by how many spaces to indent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.