开发者

emacs formatting problems

How can I configure it so that when I create and edit files in emacs the formatting looks the same in editors such as Geany or gedit,, it seems that the indentation is never preserved cor开发者_StackOverflowrectly.


This is probably related to tab ('\t', 0x9) characters. To forbid emacs from adding tab characters, customize indent-tabs-mode to nil. (C-h v indent-tabs-mode). To replace all tabs in existing files with spaces (and keep it looking as it currently does in emacs), use M-x untabify (acts on the current region).


Indentation in Emacs is complicated. If you're new to Emacs then it might seem a bit daunting, but I strongly advise spending the time reading about it if you want to know why Emacs indentation works the way that it does. It will make life easier in the long run.


I assume that you are an emacs beginner. You need to customize emacs. The defaults may not suit to your needs. Depend upon the type of the file you edit, you have to set the appropriate mode. For example, editing text file needs M-x text-mode and for Perl files, you need M-x cperl-mode etc. If the question is related to indentation, look at http://www.emacswiki.org/emacs/IndentationBasics

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜