emacs is incredibly powerful, but configuration can be a royal pain sometime.
Here’s me trying to set the indentation levels when editing HTML. (Because it’s not obvious at all.)
1 |
M-x customize-group RET nxml |
Go to Nxml Child Indent, set that to what you want. In my case, I use 4 spaces per TAB.
These are the settings in my .emacs (you can see that I’m really trying to just set 4 spaces per TAB for all the modes):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
(setq-default tab-width 4) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(django-indent-width 4) '(nxhtml-default-encoding (quote utf-8)) '(nxml-child-indent 4)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) (add-hook 'html-mode-hook (lambda () ;; Default indentation is usually 2 spaces, changing to 4. (set (make-local-variable 'sgml-basic-offset) 4))) |
Emacs can be annoying in the sheer number of uncorrelated variables it uses for the various modes.