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