在文本模式下在Emacs中设置4个空格缩进 [英] Set 4 Space Indent in Emacs in Text Mode
问题描述
当主要模式 text-mode $时,在缓冲区中按 TAB 时,我不能让Emacs从8个空格键切换到4个空格。 C $ C>。我已将以下内容添加到我的
.emacs
中:
(setq -default indent-tabs-mode nil)
(setq-default tab-width 4)
;;;我试过
(setq indent-tabs-mode nil)
(setq tab-width 4)
无论我如何更改我的 .emacs
文件(或我的缓冲区的本地变量), TAB 按钮总是一样
- 如果上面没有文字,缩进 8 空格
- 如果上一行有文字,缩进到第二个单词的开始
尽管我喜欢Emacs这是变得烦人有没有办法使Emacs至少缩进4个空格,如果上一行没有文本?
(customize-variable(quote tab-stop-list))
或添加
pre> (custom-set-variables
;; custom-set-variables是由Custom添加的。
;;如果你手动编辑,你可以乱
;;你的init文件应该只包含一个这样的实例
;;如果有多个,它们将无法正常工作
'(tab -stop-list(报价(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120)))
I've been unsuccessful in getting Emacs to switch from 8 space tabs to 4 space tabs when pressing the TAB in buffers with the major mode text-mode
. I've added the following to my .emacs
:
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
;;; And I have tried
(setq indent-tabs-mode nil)
(setq tab-width 4)
No matter how I change my .emacs
file (or my buffer's local variables) the TAB button always does the same thing.
- If there is no text above, indent 8 spaces
- If there is text on the previous line, indent to the beginning of the second word
As much as I love Emacs this is getting annoying. Is there a way to make Emacs to at least indent 4 space when there's not text in the previous line?
(customize-variable (quote tab-stop-list))
or add tab-stop-list entry to custom-set-variables in .emacs file:
(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.
'(tab-stop-list (quote (4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120))))
这篇关于在文本模式下在Emacs中设置4个空格缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!