I'm trying to get rid of tabs, following this guide:
(setq-default indent-tabs-mode nil)
So: why setq-default
and not setq
? I know I would need to use setq-default
for a buffer-local variable, but I can't actually determine (except from inferring from the guide) whether indent-tabs-mode
is buffer local.
C-h v
return something more confusing to me:
Automatically becomes buffer-local when set.
So it would become buffer local if I setq
it, so I must setq-default
it?
indent-tabs-mode
, sosetq-default
is not a 100% guarantee that your buffer will have said default setting. Only if nothing else sets that variable differently when using a particular combination of major-mode and minor-modes would that default setting be respected. Thus, it may be necessary to use a major-mode hook to set the variable to your liking. Here is link to a recent example where thetab-width
is set by a major mode to4
and a major-mode hook is used to reset the value to2
. emacs.stackexchange.com/a/10329/2287