Emacs 作为 C 编程 IDE 配置?

发布于 2024-11-03 13:12:32 字数 506 浏览 2 评论 0原文

我使用 emacs 作为 C 语言编程的主要 IDE。我正在探索配置 emacs 的方法,使其更多地充当 IDE 而不是简单的文本编辑器。当然,我想要语法突出显示,最好是一些代码完成。我还想要单独的缓冲区来允许 shell 命令和 Mx 编译。我希望它在访问 C 源文件时自动打开这种多缓冲区形式,而不必单独启动每个缓冲区。我将主要使用它来进行 Linux/BSD Unix 开发,不过我也在 Mac OS X(又是 Unix)和 Windows(Windows 7 64 位)上进行编码。

我探索了 Phil Hagelberg (technomancy) 发布的 Emacs 入门工具包,但它似乎非常面向动态语言和 git 的使用。我主要使用 emacs 进行 C 开发,使用 Mercurial 进行 VC 开发。我也是一个相对新手,配置 emacs 对我来说相对令人畏惧。

我现在正在使用 CEDET 和 Emacs 代码浏览器 (ECB) 包,它更符合我想要的,但仍然不完美。

欢迎任何关于将 emacs 定制为 C 编程 IDE 的建议。

I use emacs as my main IDE for programming in C. I am exploring ways of configuring emacs to function more as an IDE rather than as a simple text editor. Of course I want syntax highlighting and preferably some code completion. I also want separate buffers to allow shell commands and to M-x compile. I want it to open into this multi-buffer form automatically when visiting a C source file, rather than having to launch each buffer separately. I will be using this mainly for Linux/BSD Unix development, though I also code on Mac OS X (again Unix) and Windows (Windows 7 64bit).

I explored the Emacs starter kit posted by Phil Hagelberg (technomancy), but it seems very oriented towards dynamic languages and use of git. I use emacs mainly for developing in C and use mercurial for VC. I am also a relative newbie making configuration of emacs relatively daunting for me.

I am now playing with CEDET and the Emacs Code Browser (ECB) package which is more along the lines of what I want, but is still not perfect.

Any suggestions on customizing emacs as a C programming IDE welcome.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不美如何 2024-11-10 13:12:32

自从我完成 C 以来已经有一段时间了,但这里有一些建议。

  1. 使用 flymake 进行动态错误分析。我已经将它用于 Python 和 C,它真的很棒。
  2. C 模式中默认存在语法高亮显示。
  3. Mx 编译是针对 make 的,因此如果您的设置中有 Makefile,它应该可以正常工作(默认的 Flymake 规则也使用它)。像这样的规则
check-syntax:
          gcc -Wall -o nul -S ${CHK_SOURCES}

将照顾flymake。 当您在子目录中编辑但想要从顶部编译时非常有用。

  1. etags 对于跳转代码很有用。 GnuGlobal 似乎也很受欢迎。
  2. 无法对欧洲央行发表评论,因为我从未真正让它完全发挥作用,而且当我真正做到这一点时,我也从未发现它有什么用处。我使用 autocomplete.el 来完成补全,但它与上下文无关。
  3. 没有建议 6.
  4. 内置的 vc 集成对于 git 来说不太热,所以我使用 magit 相反。 Mercurial 应该有类似的选项。
  5. 这里有一些关于设置缩进的注意事项。
  6. 您应该使用哪种功能模式。过去它让我省去了很多头痛。
  7. GUD 的默认值相当不错,但您应该花一些时间熟悉它们以使用它们这完全是权力。
  8. 我大量使用 org-capture 将 TBD 移动到我的组织模式缓冲区中,以便我可以跟踪它们作为 TODO 项目。这适用于所有语言。我还使用 org-mode 来维护我所有项目的开发日记。

祝你好运。

It's been a while since I've done C but here are a few pointers.

  1. Use flymake for on the fly error analysis. I have used it for Python and C and it's really awesome.
  2. Syntax highlighting is there by default in the C mode.
  3. M-x compile is geared towards make so if you have a Makefile in your setup, it should work fine (the defauly flymake rules use this as well). A rule like this
check-syntax:
          gcc -Wall -o nul -S ${CHK_SOURCES}

would take care of flymake. This is useful when you edit in subdirectories but want to compile fromt he top.

  1. etags is useful to jump around the code. GnuGlobal also seems to be popular.
  2. Can't comment on ECB since I've never really gotten it to work completely and when I sort of did, I never found it that useful. I use autocomplete.el to do completions but it's not context sensitive.
  3. There is no suggestion 6.
  4. The inbuilt vc integration is not so hot for git and so I use magit instead. There should be similar options for mercurial.
  5. There are some notes here on setting up your indentation.
  6. You should use which function mode. It's saved me a lot of headache in the past.
  7. The defaults for GUD are pretty decent but you should take a while and familiarise yourself with them to use it's power completely.
  8. I heavily use org-capture to move TBDs into my org mode buffers so that I can track them as TODO items. This is for all languages. I also use org-mode to maintain a development diary for all my projects.

Good luck.

滿滿的愛 2024-11-10 13:12:32

阅读这篇关于如何配置 CEDET 的优秀指南。我还建议您同时使用 cscope 和 ECB。正如 Noufal 已经提到的,自动完成和 Flymake 非常有帮助。我还建议您自动配对模式

Read this excellent guide on how to configure CEDET. I'd also advise you to use cscope and ECB alongside it. As Noufal already mentioned autocomplete and flymake are very helpful. I'd also recommend you autopair mode.

や三分注定 2024-11-10 13:12:32

我没有尝试 Emacs-IDE 但它看起来很有用并且可能对你有帮助

i didn't try out Emacs-IDE but it seems useful and may help you

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文