«
»

emacs

emacs as a C IDE

01.04.13 | Comment?

Here is my emacs for C coding setup:

  • Packages:
    • flymake – not using this right now as gcc won’t compile for the MCU I am targeting
    • compile
    • flyspell
    • auto-complete
    • rainbow-delimiters-mode
  • Formatting
    • M-x align – Align comments, equal sign, etc.
  • Other tools
    • etags – M-. (jump to definition). See link for building TAGS table.
    • which-function-mode – List the current function in the mode line.
    • show-paren-mode – Highlight the matching paren or brace when cursor is next to a paren. The link also gives some other useful keyboard shortcuts.
    • org capture – Grab marked text into an org file. Alternately, try fixeme-mode. Also eproject extras may do this nicely.
    • semantic for Speedbar – Use a better C parser for the speedbar

My current config:

;;
;; C mode modifications
;;
(require 'compile)
(add-hook 'c-mode-hook (lambda ()
          (add-to-list 'compilation-error-regexp-alist 'x51)
          (add-to-list 'compilation-error-regexp-alist-alist 
                 '(x51 
                   "^... \\(\\w+\\) .*IN LINE \\([0-9]+\\) OF \\([^:]+\\):"
                   3 2 nil 1))           
          (flyspell-prog-mode)
          (rainbow-delimiters-mode)
          (setq compilation-auto-jump-to-first-error t)
          (which-function-mode)
          (show-paren-mode)
          (add-hook 'speedbar-load-hook (lambda () (require 'semantic/sb)))
    ))
;;Auto-Conmplete
(require 'auto-complete)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(require 'auto-complete-config)
(ac-config-default)

Much of this is based on the useful notes in this SO post.

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

You must be logged in to post a comment.


«
»