The problem is that I want Emacs to save tabs when I entered them as tabs and spaces if I entered them as spaces. But the editor replaces my manually typed spaces with tab when the number of spaces reaches amonut that is defined in tab-stop-list
, i.e. when I type
→func1() {
→ →some_long_command_name -param1 -param2 \
→ →→→→→→→→→→→→→→→→→→→→→→→→-param3 -param4
(where tab is →
and space is →
) Emacs makes it
→func1() {
→ →some_long_command_name -param1 -param2 \
→ → → → → → →→→→-param3 -param4
Which breaks the indentation I wanted to preserve, if the length of the tab changes.
Customize option indent-tabs-mode
to give the value nil
. This stops Emacs from converting indentation whitespace to use TAB
chars. SPC
chars and TAB
chars that you enter remain such.
Then you will need to either bind key TAB
to self-insert-command
or else use C-q TAB
to insert a TAB
character. This means that you lose the TAB
key as an indentation command. Alternatively, you could bind some other key to a command that inserts a TAB
char, or else bind some other key than TAB
to the indentation command that TAB
is bound to by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With