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