When I open a config file that has been indented with tabs, the mode shows as (Conf[Space] WS)
and pressing Tab
indents with spaces, even though the rest of the file is using tabs.
How can I change this mode to indent with tab characters instead?
I thought [Space]
might have meant it was a minor mode, so I looked into changing the minor mode but the list of minor modes in the manual doesn't mention anything about a tab mode.
The EmacsWiki mentions an indent-tabs-mode
however this does not appear to be in version 25.1.1 that I am using.
I looked into customize-mode
however I can't find anything in there about indenting.
Is there a setting to change conf-mode
to indent with tabs instead?
Update with suggestions from @Basil:
(setq indent-tabs-mode t)
has no effect. After running it with M-:
, pressing the tab key is the same as pressing the spacebar multiple times (enough to match the first non-leading space character on the previous line.)
Putting the add-hook
code suggested by @Basil in my init.el
, closing the buffer, reloading Emacs, then reopening the file, also has no effect. Pressing the tab key is the same as pressing the spacebar multiple times.
(setq tab-width N)
immediately changes the width of the existing tabs in the file. On a line with no spaces on the line above it, setting tab-width
to 2
makes the tab key insert two spaces, setting it to 8
makes the tab key equivalent to pressing the spacebar eight times.