1 ;; Configuration file for cc-ide.el (Emacs C++ IDE extension, see http://g0dil.de)
3 (defun check-namespace-indent (arg)
6 (if (looking-at "namespace") [0] '+)))
10 (c-backslash-column . 98)
11 (c-cleanup-list . (empty-defun-braces
15 (c-hanging-braces-alist . ((namespace-open after)
16 (namespace-close before after)
19 (substatement-open after)
20 (block-close . c-snug-do-while)
21 (extern-lang-open after)
22 (inexpr-class-open after)
23 (inexpr-class-close before)))
24 (c-offsets-alist . ((namespace-open . [0])
25 (namespace-close . [0])
26 (innamespace . check-namespace-indent)
27 (statement-block-intro . +)
28 (substatement-open . 0)
30 (statement-cont . +))) ))
32 (c-add-style "senf" senf-c-style)
34 (set (make-local-variable 'ccide-file-vars)
35 '(( fill-column . 100 )
36 ( comment-column . 40 )
37 ( c-file-style . "senf" )
38 ( indent-tabs-mode . nil )
39 ( ispell-local-dictionary . "american" )
40 ( compile-command . "scons -u test") ))
42 (set (make-local-variable 'ccide-default-copyright)
44 "// This program is free software; you can redistribute it and/or modify\n"
45 "// it under the terms of the GNU General Public License as published by\n"
46 "// the Free Software Foundation; either version 2 of the License, or\n"
47 "// (at your option) any later version.\n"
49 "// This program is distributed in the hope that it will be useful,\n"
50 "// but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
51 "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
52 "// GNU General Public License for more details.\n"
54 "// You should have received a copy of the GNU General Public License\n"
55 "// along with this program; if not, write to the\n"
56 "// Free Software Foundation, Inc.,\n"
57 "// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"))
59 (set (make-local-variable 'ccide-project-name) "SENF")
61 (let ((local-conf (ccide-project-search-upwards "project-local.el")))
63 (load-file local-conf)))
65 (defun flyspell-cc-progmode-verify ()
66 "Replacement for standard flyspell-generic-progmode-verify which
67 checks for C/C++ preproc directives. Additionally, anything after ^L
68 is ignored (Those are the file local variables and local words)."
69 (let ((f (get-text-property (point) 'face)))
70 (and (memq f flyspell-prog-text-faces)
73 (looking-at "\\(//\\)?#")))
74 (not (let ((l (max (point-min) (- (point-max) 4096))))
76 (save-excursion (search-backward "
\f" l t))))))))
78 (defun flyspell-cc-mode ()
79 "Torn on `flyspell-mode` for comments and strings in C/C++ mode."
81 (setq flyspell-generic-check-word-p 'flyspell-cc-progmode-verify)
84 ;; Better set this here than in the file variables since the setting
85 ;; is only valid if project.el is loaded ...
86 (set (make-local-variable 'ispell-personal-dictionary)
87 (expand-file-name "senf.dict" ccide-project-root))
90 (defun senf-new-file-hook ()
91 (when (string-match "\\.test\\.cc$" (buffer-file-name))
93 (goto-char (point-min))
94 (search-forward "auto_unit_test.hpp")
96 (delete-region (point) (progn (end-of-line) (point)))
98 (string-replace "[^/]+/" "../" (substring (file-name-directory (buffer-file-name))
99 (length ccide-project-root)) t)
100 "Utils/auto_unit_test.hh\""))))
102 (add-hook 'ccide-new-file-hooks 'senf-new-file-hook nil t)