X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=project.el;h=7211395698bf0ebb8cd33dc858a52acaa1421a8a;hb=81ffa1c459b96dd44472bcef37e1e373934ee138;hp=fa52c6d6a32bc39bda7adc82fd60f6e2ce3cce52;hpb=145f6a7d0f3a6aaa77b3625351c952d24cb0b8a1;p=senf.git diff --git a/project.el b/project.el index fa52c6d..7211395 100644 --- a/project.el +++ b/project.el @@ -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) @@ -54,3 +55,28 @@ (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 " " 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)