【发布时间】:2013-01-03 09:28:55
【问题描述】:
我对 emacs 完全陌生(主要使用 vim 和 eclipse/netbeans 等)。我正在玩 C 代码的多级嵌套,并在 emacs 中编写了一个示例代码来测试它如何缩进嵌套的代码。深度(虽然不是现实生活中的代码)。
int foo()
{
if (something) {
if (anotherthing) {
if (something_else) {
if (oh_yes) {
if (ah_now_i_got_it) {
printf("Yes!!!\n");
}
}
}
}
}
}
当我在 emacs 中输入并保存时,这看起来就像这样。但是在不同的文本编辑器上打开它显示保存的实际文本是这样的:
int foo()
{
if (something) {
if (anotherthing) {
if (something_else) {
if (oh_yes) {
if (ah_now_i_got_it) {
printf("Yes!!!\n");
}
}
}
}
}
}
所以我想知道 emacs 中是否有任何方法可以按照实际显示的方式保存文本?
我当前的 c-default-style 设置为“linux”。
编辑:
好的,我正在使用 Notepad++/Vim 查看 emacs 保存的文件,它显示“错误”的缩进,但看起来,用好的旧记事本打开(甚至是 cat file.c)显示正确的缩进如emacs所示。将尝试这里提到的其他方法。谢谢!
【问题讨论】:
-
也许this article from the EMACS wiki可以帮助你。
标签: c emacs indentation