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