In web-mode
, indentation for markup gets set to 8
when I open a new buffer.
I have set web-mode-indent-markup-indent-offset
via customize to 2
. When I check it outside of a web-mode
buffer, it is set to 2
.
Lines concerning web-mode
in my .emacs
:
(mapcar (lambda (plugin-dir)
(add-to-list 'load-path (concat "~/.emacs.d/plugins/" plugin-dir)))
'( ;; ... some more plugins
"web-mode"))
(add-hook 'web-mode-hook 'zencoding-mode)
(custom-set-variables
;; ...
'(web-mode-markup-indent-offset 2)
;; ...
)
(require 'web-mode)
(mapcar (lambda (file-ending)
(add-to-list 'auto-mode-alist (cons file-ending 'web-mode)))
'("\\.php\\'" "\\.ejb\\'" "\\.django\\'" "\\.tt\\'" "\\.html\\'"))
(define-key web-mode-map (kbd "C-c /") 'web-mode-element-close)
(defun expand-for-web-mode ()
(when (equal mode-name "Web")
(make-local-variable 'yas-extra-modes)
(setq yas-extra-modes
(let ((web-lang (web-mode-language-at-pos)))
(cond
((equal web-lang "html") '(html-mode))
((equal web-lang "css") '(css-mode))
((equal web-lang "javascript") '(javascript-mode))
)))))
(add-hook 'yas-before-expand-snippet-hook 'expand-for-web-mode)
Furthermore, I use expand-region
. It sets a hook to web-mode
, but the hook just adds web-mode-mark-and-expand
to a local er/try-expand-list
variable.
I have tried a "minimal" configuration, by starting Emacs via emacs -q
and just loading and requiring web-mode
and setting the variable to 2
- same result.
Every time I enter a web-mode
buffer it gets set locally to 8
.
I know I could use a hook like this:
(add-hook 'web-mode-hook
(lambda () ""
(setq web-mode-markup-indent-offset 2)))
To set it to 2
, but that defeats the purpose of customize
.
web-mode
? (If not you can try installing it directly from the GitHub repo.)