I would like to have an .emacs setting so that tabs are always formed by consecutive spaces. Preferably in each possible mode. In other editors it never seemed a problem, but in .emacs I'm a bit stuck with the tabs I'm afraid.
Thankfully, Emacs has facilities in place that make it possible to easily convert between tabs and spaces. The commands tabify and untabify do just that; they convert the region to tabs or whitespaces.
This is because standard tabs are set to eight spaces. Tabs are special characters.
To manually insert a tab in Emacs, use ctrl-Q TAB. control-Q causes the next key to be inserted rather than interpreted as a possible command.
add this in your .emacs:
(setq-default indent-tabs-mode nil)
or you can define a before-save-hook that eliminate hard tabs
Also of use, M-x untabify
, which will convert all the tabs into spaces in the current region. You can use this to get rid of the existing tabs in files you've edited before you had the indent-tabs-mode
set properly.
C-x h (M-x mark-whole-buffer) M-x untabify
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