I work on an open source project where the creator sets his tab-indents to 2 spaces.
I\'d like to just enable it on the fly for the one file I work on and not other fil
I use a snippet of code in my init.el
that tries to auto-detect files that use 2-space indents, and switch Emacs's indentation for that file to 2 spaces when it sees such files:
(add-hook 'js-mode-hook
(lambda ()
(when (string-match-p "^ [A-Za-z]" (buffer-string))
(make-variable-buffer-local 'js-indent-level)
(set-variable 'js-indent-level 2))))