c/c++语言开发共享用于C代码的多级嵌套的Emacs缩进

我是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的。 将尝试这里提到的其他方法。 谢谢!

    尝试使用空格而不是制表符进行缩进。 将以下内容添加到init.el:

     (setq-default indent-tabs-mode nil) 

    这将使所有缓冲区默认使用空格。 您将需要为makefile添加以下exception:

     (add-hook 'makefile-mode-hook (lambda () (setq indent-tabs-mode t))) 

      以上就是c/c++开发分享用于C代码的多级嵌套的Emacs缩进相关内容,想了解更多C/C++开发(异常处理)及C/C++游戏开发关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/c-cdevelopment/550103.html

      (0)
      上一篇 2021年1月14日
      下一篇 2021年1月14日

      精彩推荐