[英]How do I get js2-mode to use spaces instead of tabs in Emacs?
你有没有
(setq-default indent-tabs-mode nil)
在你的.emacs? 当我这样做时,它在emacs 23.0.60.1中对我很好。 js2-mode使用标准的emacs函数indent-to,它遵循indent-tabs-mode来进行缩进。
加载js2模式后,将其添加到您的.emacs
文件中:
(setq js2-mode-hook
'(lambda () (progn
(set-variable 'indent-tabs-mode nil))))
在我的GNU Emacs 24.2.1副本上,设置:
(setq-default indent-tabs-mode nil)
在.emacs中对于javascript模式是不够的,大概是因为在每个缓冲区上下文中设置以某种方式被覆盖。 以下更改就足够了:
(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.
'(indent-tabs-mode nil))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.