I personally use 2 spaces for indentation but everyone has a preference and I'd like to respect that. When I open someone else's files I would prefer to use their indentation scheme. In my .emacs file here is everything I use to set my indentation:
(setq css-indent-offset 2)
(setq js-indent-level 2)
(setq javascript-indent-level 2)
(setq-default python-indent 2) ;emacs 23
(setq-default python-indent-offset 2); emacs 24
(add-hook 'python-mode-hook
(lambda () (setq tab-width 2)))
(setq html-indent-offset 2)
(setq-default indent-tabs-mode nil)
(setq default-tab-width 2)
(add-hook 'html-mode-hook
(lambda()
(setq sgml-basic-offset 2)))
I could modify .emacs every time I want to use a different format, but I'd rather visually identify the indentation mode and manually change the variables (for the current emacs process only) to match the indentation of the file.
Now I know very little about emacs/elisp, but my assumption was M-x setq intent-tabs-mode t
would make my tab key generate tabs instead of spaces. No such luck and googling has gotten me no where. Any thoughts?
TAB
. Your assumption is misplaced. See this page.