From 9d53d9b19c2d3fba7d4cfde96974e14e710c2022 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Tue, 26 Apr 2011 09:30:24 +0200 Subject: [PATCH] EMACS: c-mode keys * Mapped to c-indent-new-comment-line followed by a c-indent-line-or-region. * Mapped 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. --- emacs.d/20-c-mode.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)))