开发者

Emacs as a C Programming IDE Configuration?

开发者 https://www.devze.com 2023-02-28 19:24 出处:网络
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 prefe

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 all开发者_如何学Pythonow 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.


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.


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.


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

0

精彩评论

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