immerrr/lua-mode

Add an option to indent with tabs

tessiof opened this issue · 2 comments

Hi,
I couldn't find an option to indent using tabs instead of spaces. I'm very new to Emacs, so I might be missing something obvious.

Firstly, welcome to Emacs world. Hope it treats you well and doesn't scare you off with the learning curve.

Secondly, when encountering a thing that has to have been solved elsewhere, it is good to use search and/or ask questions in places that are there to receive questions, e.g. https://emacs.stackexchange.com or Emacs mailing list if you feel like trying something old school. Bug trackers can be used to ask questions, but they are usually only frequented by maintainers and it is more efficient if more people have the ability to answer.

Finally, to answer your question, I would probably do that with indent-tabs-mode which will replace every tab-width of indentation with a tab. Something like this should get you started.

(defun my-lua-mode-hook ()
  (setq-local indent-tabs-mode t)
  (setq-local tab-width lua-indent-level))

(add-hook lua-mode-hook #'my-lua-mode-hook)

It worked, thanks! I just had to add a single quote before lua-mode-hook: (add-hook 'lua-mode-hook #'my-lua-mode-hook)