1 ;; Configuration file for cc-ide.el (Emacs C++ IDE extension, see http://g0dil.de)
3 (defun check-namespace-indent (arg)
6 (if (and (looking-at "namespace")
8 (not (looking-at ".*}")))
11 (defconst senf-c-style
12 '((c-basic-offset . 4)
13 (c-backslash-column . 98)
14 (c-cleanup-list . (empty-defun-braces
18 (c-hanging-braces-alist . ((namespace-open after)
19 (namespace-close before after)
22 (substatement-open after)
23 (block-close . c-snug-do-while)
24 (extern-lang-open after)
25 (inexpr-class-open after)
26 (inexpr-class-close before)))
27 (c-offsets-alist . ((namespace-open . [0])
28 (namespace-close . [0])
29 (innamespace . check-namespace-indent)
30 (statement-block-intro . +)
31 (substatement-open . 0)
33 (statement-cont . +))) ))
35 (c-add-style "senf" senf-c-style)
37 (defun flyspell-cc-progmode-verify ()
38 "Replacement for standard flyspell-generic-progmode-verify which
39 checks for C/C++ preproc directives. Additionally, anything after ^L
40 is ignored (Those are the file local variables and local words)."
41 (let ((f (get-text-property (point) 'face)))
42 (and (memq f flyspell-prog-text-faces)
45 (looking-at "\\(//\\)?#")))
46 (not (let ((l (max (point-min) (- (point-max) 4096))))
48 (save-excursion (search-backward "
\f" l t))))))))
50 (defun flyspell-cc-mode ()
51 "Torn on `flyspell-mode` for comments and strings in C/C++ mode."
53 (setq flyspell-generic-check-word-p 'flyspell-cc-progmode-verify)
56 (defun senf-new-file-hook ()
57 (when (string-match "\\.test\\.cc$" (buffer-file-name))
59 (goto-char (point-min))
60 (search-forward "auto_unit_test.hpp")
62 (delete-region (point) (progn (end-of-line) (point)))
63 (insert "#include <senf/Utils/auto_unit_test.hh>"))))
65 (defun senf-ccide-init ()
67 (set (make-local-variable 'ccide-file-vars)
70 (c-file-style . "senf")
71 (indent-tabs-mode . nil)
72 (ispell-local-dictionary . "american")
73 (compile-command . "scons -u test")))
75 (set (make-local-variable 'ccide-default-copyright)
77 "// This program is free software; you can redistribute it and/or modify\n"
78 "// it under the terms of the GNU General Public License as published by\n"
79 "// the Free Software Foundation; either version 2 of the License, or\n"
80 "// (at your option) any later version.\n"
82 "// This program is distributed in the hope that it will be useful,\n"
83 "// but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
84 "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
85 "// GNU General Public License for more details.\n"
87 "// You should have received a copy of the GNU General Public License\n"
88 "// along with this program; if not, write to the\n"
89 "// Free Software Foundation, Inc.,\n"
90 "// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"))
92 (set (make-local-variable 'ccide-project-name) "SENF")
94 (let ((local-conf (ccide-project-search-upwards "project-local.el")))
96 (load-file local-conf)))
98 ;; Better set this here than in the file variables since the setting
99 ;; is only valid if project.el is loaded ...
100 (set (make-local-variable 'ispell-personal-dictionary)
101 (expand-file-name "tools/senf.dict" ccide-project-root))
104 (add-hook 'ccide-new-file-hooks 'senf-new-file-hook nil t)
106 (setq indent-tabs-mode nil) ;; needed since whitespace-mode caches this value ...
113 ;; indent-tabs-mode: nil