I would like to have an .emacs setting so that tabs are always formed by consecutive spaces. Preferably in each possible mode. In other editors it never seemed a problem, but in .emacs I'm a bit stuck with the tabs I'm afraid.
我想有一个.emacs设置,以便标签总是由连续的空格组成。优选地,在每种可能的模式在其他编辑器中,它似乎永远不会成为一个问题,但在.emacs中,我有点担心我害怕的标签。
2 个解决方案
#1
add this in your .emacs:
在.emacs中添加:
(setq-default indent-tabs-mode nil)
or you can define a before-save-hook that eliminate hard tabs
或者你可以定义一个消除硬标签的before-save-hook
#2
Also of use, M-x untabify
, which will convert all the tabs into spaces in the current region. You can use this to get rid of the existing tabs in files you've edited before you had the indent-tabs-mode
set properly.
同样有用,M-x untabify,它将所有标签转换为当前区域的空格。在正确设置indent-tabs-mode之前,您可以使用它来删除已编辑的文件中的现有选项卡。
C-x h (M-x mark-whole-buffer)
M-x untabify
#1
add this in your .emacs:
在.emacs中添加:
(setq-default indent-tabs-mode nil)
or you can define a before-save-hook that eliminate hard tabs
或者你可以定义一个消除硬标签的before-save-hook
#2
Also of use, M-x untabify
, which will convert all the tabs into spaces in the current region. You can use this to get rid of the existing tabs in files you've edited before you had the indent-tabs-mode
set properly.
同样有用,M-x untabify,它将所有标签转换为当前区域的空格。在正确设置indent-tabs-mode之前,您可以使用它来删除已编辑的文件中的现有选项卡。
C-x h (M-x mark-whole-buffer)
M-x untabify