Setting tab size in Emacs

你。 提交于 2020-01-01 06:13:29

问题


I'm using Emacs as an editor. I want to set the tab size to four spaces. In my .emacs file I have the following:

(setq default-tab-width 4)

I've also tried:

(set-default tab-width 4)

Either way, when I open emacs and try to tab, it inserts two spaces. Am I doing something wrong? It almost seems like its not seeing my .emacs file.

Any suggestions would be great! Thanks!


回答1:


The tab-width variable doesn't determine the amount of indenting per level, and the TAB key doesn't insert a tab: it indents the current line to the correct indentation level in most language modes.

If you're programming in C, C++ or Java (and a few more, based on cc-mode), try setting c-basic-offset to 4. Or hit C-c . and select another indentation style; there might be one that matches your taste.



来源:https://stackoverflow.com/questions/2517207/setting-tab-size-in-emacs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!