我正在使用js2-mode在 Emacs 中编辑 Javascript,但我似乎无法让它停止使用制表符而不是空格进行缩进。我的其他模式工作正常,只是在使用 js2 时出现问题。
Patrick Ritchie
问问题
6141 次
3 回答
24
你有
(setq-default indent-tabs-mode nil)
在你的 .emacs 中?当我这样做时,它在 emacs 23.0.60.1 中对我来说很好。js2-mode 使用标准的 emacs 函数 indent-to,它尊重 indent-tabs-mode,进行缩进。
于 2008-09-05T16:14:19.537 回答
10
.emacs
加载 js2 模式后将其添加到文件中:
(setq js2-mode-hook
'(lambda () (progn
(set-variable 'indent-tabs-mode nil))))
于 2011-10-31T17:26:03.600 回答
5
在我的 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))
于 2015-05-23T18:12:06.353 回答