(require 'cc-mode) ;; Try to configure the C/C++ mode a little (c-add-style "daniel" '( (c-basic-offset . 2) (c-comment-only-line-offset . 0) (c-offsets-alist . ( (arglist-intro . c-lineup-arglist-intro-after-paren) (arglist-close . c-lineup-arglist) (substatement-open . 0) (inline-open . 0) ) ) ) ) (defun electric-c-newline (arg) "Inserts a newline, and runs the indent command" (interactive "P") (c-indent-line) (newline) (c-indent-line) ) (add-hook 'c-mode-common-hook '(lambda () (setq indent-tabs-mode t) (c-set-style "linux") (setq c-recognize-knr-p nil) )) (define-key c-mode-map "\r" 'electric-c-newline) (define-key c++-mode-map "\r" 'electric-c-newline) ;; Finally do the thang (provide 'cmode-stuff)