I use an indentation sensitive language (imba) and I need to always use tabs.

I'm using doom emacs and I'm also writing a wip major mode for Imba. But I press tab and it adds indentation using tabs (a tab or more) followed by two spaces !!

The two spaces drive me insane, and I tried many things to get rid of them:

  • Disable electric-indenent-mode (setq electric-indent-mode nil)
  • (setq indent-tabs-mode t)

And I tried and removed a couple of other options

;; (setq-default tab-width 2)
;; (setq-default evil-shift-width 2)
;; (setq-default evil-shift-round nil)
;; (setq-default tab-always-indent 'complete)

Also, I tried enabling editorconfig which is supposed to use the following config

indent_style = tab
indent_size = 4

But still, tabs are not working as I wish.

  • 2
    The key is to set a non-nil indent-tabs-mode, and also ensure that your mode only ever indents in multiples of tab-width. E.g. if you have a tab width of 4 and indent by 6 columns, it's necessary that there are 2 spaces. Make sure your mode doesn't do that.
    – phils
    Mar 6 at 11:53
  • 1
    I suggest you look at Emacs’ built-in mode for Makefiles, where tabs are likewise significant.
    – d125q
    Mar 7 at 12:42


Your Answer

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

Browse other questions tagged or ask your own question.