diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2017-09-28 18:42:19 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2017-09-28 18:42:19 +0200 |
| commit | e1f12f424a2f1701fa9b1fcc974e75c0f224cfa3 (patch) | |
| tree | 8e6f60218dfa84c3e6fc8d496feaf49117ff727f | |
| parent | b9940e65f978b6a3980ae0b27169eb1e913fc39b (diff) | |
Transfer chromium rules from stark to blue
| -rw-r--r-- | emacs-blue | 40 |
1 files changed, 39 insertions, 1 deletions
@@ -231,9 +231,18 @@ '("common c" (c-basic-offset . 2))) +(defun get-base-dir (path needle) + "Get base directory for PATH using NEEDLE to cut." + (let ((parts (split-string path "/" t))) + (let ((index (cl-position needle parts :from-end t :test 'equal))) + (if index + (concat "/" (mapconcat 'identity (seq-take parts (+ index 1)) "/")) + path)))) + (make-variable-buffer-local 'flycheck-clang-definitions) (make-variable-buffer-local 'flycheck-clang-include-path) (make-variable-buffer-local 'flycheck-clang-language-standard) +(make-variable-buffer-local 'flycheck-clang-warnings) (add-hook 'c++-mode-hook (lambda() @@ -270,7 +279,36 @@ "/usr/lib/glib-2.0/include" "../subprojects/googletest-release-1.8.0/googletest/include" "../subprojects/googletest-release-1.8.0/googlemock/include" - ))))) + ))) + ;; Chromium hook + (when (and buffer-file-name + (string-match "/chromium/src/" buffer-file-name)) + (let ((base (get-base-dir (file-name-directory buffer-file-name) "src"))) + (make-local-variable 'flycheck-clang-language-standard) + (make-local-variable 'flycheck-clang-include-path) + (setq flycheck-clang-language-standard "c++11" + flycheck-clang-definitions (list "OS_ANDROID") + flycheck-clang-warnings (list "no-unused-parameter") + flycheck-clang-include-path (list base + (concat base "/out_gradle/BetaArm7Debug/gen") + (concat base "/out_gradle/BetaArm7Release/gen")))) + (require 'google-c-style) + (c-add-style "Google" google-c-style t)) + ;; ofa hook + (when (and buffer-file-name + (string-match "/mobile/mobile/" buffer-file-name)) + (let ((base (get-base-dir (file-name-directory buffer-file-name) "mobile"))) + (make-local-variable 'flycheck-clang-language-standard) + (make-local-variable 'flycheck-clang-definitions) + (make-local-variable 'flycheck-clang-include-path) + (setq flycheck-clang-language-standard "c++11" + flycheck-clang-definitions (list "OS_ANDROID") + flycheck-clang-warnings (list "no-unused-parameter") + flycheck-clang-include-path (list base (concat base "/../../chromium/src") + (concat base "/../../chromium/src/out_gradle/BetaArm7Debug/gen") + (concat base "/../../chromium/src/out_gradle/BetaArm7Release/gen")))) + (require 'google-c-style) + (c-add-style "Google" google-c-style t)))) ;; Opera Java hook (add-hook 'java-mode-hook |
