summaryrefslogtreecommitdiffstats
path: root/emacs.d
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2011-04-26 09:30:24 +0200
committerGravatar Tom Willemsen2011-04-26 09:30:24 +0200
commit9d53d9b19c2d3fba7d4cfde96974e14e710c2022 (patch)
tree3097d83bd04c5d77cc7e7a842a65c723c112bb46 /emacs.d
parentabca74c7fd18701bfa3083fdcfadf478f1038744 (diff)
downloaddotfiles-9d53d9b19c2d3fba7d4cfde96974e14e710c2022.tar.gz
dotfiles-9d53d9b19c2d3fba7d4cfde96974e14e710c2022.zip
EMACS: c-mode keys
* Mapped <Return> to c-indent-new-comment-line followed by a c-indent-line-or-region. * Mapped <C-return> to newline, since c-indent-new-comment-line inserts a \ at the end of #define statements and #include statements which makes the compiler think the line continues on the next.
Diffstat (limited to 'emacs.d')
-rw-r--r--emacs.d/20-c-mode.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/emacs.d/20-c-mode.el b/emacs.d/20-c-mode.el
index 2b05b94..ec778a9 100644
--- a/emacs.d/20-c-mode.el
+++ b/emacs.d/20-c-mode.el
@@ -1,3 +1,9 @@
(add-hook 'c-mode-hook
(lambda ()
- (local-set-key [f11] 'c-toggle-header-source)))
+ (local-set-key [f11] 'c-toggle-header-source)
+ (local-set-key "\C-m"
+ (lambda ()
+ (interactive)
+ (c-indent-new-comment-line)
+ (c-indent-line-or-region)))
+ (local-set-key [C-return] 'newline)))