Packets: Fix VariantParser invalid parser access bug
[senf.git] / project.el
index 2ec9007..85fac8b 100644 (file)
@@ -2,11 +2,12 @@
 
  (defconst senf-c-style
   '((c-basic-offset              . 4)
-    (c-cleanup-list             . (empty-defun-braces 
-                                   defun-close-semi 
-                                   list-close-comma 
-                                   scope-operator 
-                                   compact-empty-funcall))
+    (c-backslash-column          . 98)
+    (c-cleanup-list              . (empty-defun-braces 
+                                   defun-close-semi 
+                                   list-close-comma 
+                                   scope-operator 
+                                   compact-empty-funcall))
     (c-hanging-braces-alist      . ((namespace-open after)
                                     (namespace-close before after)
                                     (brace-list-open)
 (c-add-style "senf" senf-c-style)
 
 (set (make-local-variable 'ccide-file-vars)
-     '(( fill-column  . 100    )
+     '(( fill-column  . 100 )
+       ( comment-column . 40 )
        ( c-file-style . "senf" )
        ( indent-tabs-mode . nil )
-       ( ispell-local-dictionary . "american" )))
+       ( ispell-local-dictionary . "american" )
+       ( compile-command . "scons -u test") ))
 
 (set (make-local-variable 'ccide-default-copyright)
      (concat "//\n"
              "// Free Software Foundation, Inc.,\n"
              "// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n"))
 
-(let ((local-conf (expand-file-name "project-local.el" ccide-project-root)))
-  (if (file-readable-p local-conf)
+(set (make-local-variable 'ccide-project-name) "SENF")
+
+(let ((local-conf (ccide-project-search-upwards "project-local.el")))
+  (if local-conf
       (load-file local-conf)))
+
+(defun flyspell-cc-progmode-verify ()
+  "Replacement for standard flyspell-generic-progmode-verify which
+checks for C/C++ preproc directives. Additionally, anything after ^L
+is ignored (Those are the file local variables and local words)."
+  (let ((f (get-text-property (point) 'face)))
+    (and (memq f flyspell-prog-text-faces)
+        (not (save-excursion 
+               (beginning-of-line) 
+               (looking-at "\\(//\\)?#")))
+        (not (let ((l (max (point-min) (- (point-max) 4096))))
+               (and (< l (point))
+                    (save-excursion (search-backward "\f" l t))))))))
+
+(defun flyspell-cc-mode ()
+  "Torn on `flyspell-mode` for comments and strings in C/C++ mode."
+  (interactive)
+  (setq flyspell-generic-check-word-p 'flyspell-cc-progmode-verify)
+  (flyspell-mode 1))
+
+;; Better set this here than in the file variables since the setting
+;; is only valid if project.el is loaded ...
+(set (make-local-variable 'ispell-personal-dictionary)
+     (expand-file-name "senf.dict" ccide-project-root))
+(flyspell-cc-mode)