More C++ stuff

Summary:
Even more C++ tweaking and cleanup.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
This commit is contained in:
doty 2018-04-29 08:03:18 -07:00
parent e30c74b4f5
commit 8e76aa51e2
2 changed files with 54 additions and 45 deletions

View file

@ -373,49 +373,28 @@
(add-hook 'c++-mode-hook 'my-c-mode-hook) (add-hook 'c++-mode-hook 'my-c-mode-hook)
(add-hook 'java-mode-hook 'my-c-mode-hook) (add-hook 'java-mode-hook 'my-c-mode-hook)
(font-lock-add-keywords 'c-mode '(("\\<\\(__try\\)" 1 font-lock-keyword-face t))) (defconst jd-more-keywords
(font-lock-add-keywords 'c++-mode '(("\\<\\(__try\\)" 1 font-lock-keyword-face t))) '(;; These are keywords in Microsoft C/C++
(font-lock-add-keywords 'c-mode '(("\\<\\(__finally\\)" 1 font-lock-keyword-face t))) ("\\<\\(__try\\)" 1 font-lock-keyword-face t)
(font-lock-add-keywords 'c++-mode '(("\\<\\(__finally\\)" 1 font-lock-keyword-face t))) ("\\<\\(__finally\\)" 1 font-lock-keyword-face t)
(font-lock-add-keywords 'c-mode '(("\\<\\(__except\\)" 1 font-lock-keyword-face t))) ("\\<\\(__except\\)" 1 font-lock-keyword-face t)
(font-lock-add-keywords 'c++-mode '(("\\<\\(__except\\)" 1 font-lock-keyword-face t))) ;; Warnings
("\\<\\(REVIEW\\)" 1 font-lock-warning-face t)
("\\<\\(FIXME\\)" 1 font-lock-warning-face t)
("\\<\\(TODO\\)" 1 font-lock-warning-face t)
("\\<\\(BUG\\)" 1 font-lock-warning-face t)
("\\<\\(BUGBUG\\)" 1 font-lock-warning-face t)
("\\<\\(BUGBUGBUG\\)" 1 font-lock-warning-face t)
("\\<\\(HACK\\)" 1 font-lock-warning-face t)
("\\<\\(TRICK\\)" 1 font-lock-warning-face t)
("\\<\\(NOTE\\)" 1 font-lock-warning-face t))
"Keywords to add to C/C++.")
;; Warnings and such. (font-lock-add-keywords 'c-mode jd-more-keywords)
(set-face-background 'font-lock-warning-face "Yellow") (font-lock-add-keywords 'c++-mode jd-more-keywords)
(set-face-bold-p 'font-lock-warning-face t)
(defun add-todo-keyword (word)
(font-lock-add-keywords 'c++-mode
(list (list (concat "\\<\\(" word "\\):")
1 font-lock-warning-face t)))
(font-lock-add-keywords 'c-mode
(list (list (concat "\\<\\(" word "\\):")
1 font-lock-warning-face t)))
(font-lock-add-keywords 'java-mode
(list (list (concat "\\<\\(" word "\\):")
1 font-lock-warning-face t)))
(font-lock-add-keywords 'csharp-mode
(list (list (concat "\\<\\(" word "\\):")
1 font-lock-warning-face t)))
)
(add-todo-keyword "REVIEW")
(add-todo-keyword "FIXME")
(add-todo-keyword "TODO")
(add-todo-keyword "BUG")
(add-todo-keyword "BUG BUG")
(add-todo-keyword "BUG BUG BUG")
(add-todo-keyword "BUGBUG")
(add-todo-keyword "BUGBUGBUG")
(add-todo-keyword "HACK")
(add-todo-keyword "TRICK")
(add-todo-keyword "NOTE")
;; Also, comments get a different font:
;;(set-face-font 'font-lock-comment-face "-outline-Bitstream Vera Sans Mono-bold-r-normal-normal-12-90-96-96-c-*-iso10646-1")
(defun indent-buffer () (defun indent-buffer ()
"Indent the entire current buffer based on the current mode" "Indent the entire current buffer based on the current mode."
(interactive) (interactive)
(indent-region (point-min) (point-max)) (indent-region (point-min) (point-max))
(whitespace-cleanup)) (whitespace-cleanup))
@ -441,6 +420,7 @@
)))) ))))
(defun my-idl-mode-hook () (defun my-idl-mode-hook ()
"Doty's `idl-mode' hook."
(c-set-style "ms-idl")) (c-set-style "ms-idl"))
(add-hook 'idl-mode-hook 'my-idl-mode-hook) (add-hook 'idl-mode-hook 'my-idl-mode-hook)
@ -460,6 +440,35 @@
0 ; no additional indent 0 ; no additional indent
ad-do-it))) ; default behavior ad-do-it))) ; default behavior
(use-package cquery
:ensure
:if
(file-exists-p "/bin/cquery")
:bind
("M-." . xref-find-definitions)
:preface
(defun cquery//enable ()
(condition-case nil
(lsp-cquery-enable)
(user-error nil)))
:init
(use-package lsp-mode :ensure)
(use-package company-lsp
:ensure
:config (add-to-list 'company-backends 'company-lsp))
(use-package lsp-ui
:ensure
:init (add-hook 'lsp-mode-hook 'lsp-ui-mode))
(add-hook 'c-mode-common-hook #'cquery//enable)
:config
(setq
cquery-executable "/bin/cquery"
cquery-extra-args '("--log-file=/tmp/cq.log")
cquery-sem-highlight-method 'font-lock
company-transformers nil
company-lsp-async t
company-lsp-cache-candidates nil))
;; ================================================================= ;; =================================================================
;; C#-Mode configuration. ;; C#-Mode configuration.
;; ================================================================= ;; =================================================================
@ -623,7 +632,7 @@
;; ================================================================= ;; =================================================================
;; JavaScript Support ;; JavaScript Support
;; ================================================================= ;; =================================================================
(require 'rjsx-mode) ;; (require 'rjsx-mode)
(require 'prettier-js) (require 'prettier-js)
(require 'flycheck-flow) (require 'flycheck-flow)
(require 'flow-minor-mode) (require 'flow-minor-mode)
@ -634,8 +643,8 @@
'(javascript-jshint))) '(javascript-jshint)))
(flycheck-add-next-checker 'javascript-eslint 'javascript-flow) (flycheck-add-next-checker 'javascript-eslint 'javascript-flow)
(add-to-list 'auto-mode-alist '("\\.js$" . rjsx-mode)) ;; (add-to-list 'auto-mode-alist '("\\.js$" . rjsx-mode))
(add-to-list 'auto-mode-alist '("\\.jsx$" . rjsx-mode)) ;; (add-to-list 'auto-mode-alist '("\\.jsx$" . rjsx-mode))
(defun my-js-mode-hook () (defun my-js-mode-hook ()
"My custom javascript mode hook." "My custom javascript mode hook."
@ -643,7 +652,7 @@
(flow-minor-enable-automatically) (flow-minor-enable-automatically)
(prettier-js-mode)) (prettier-js-mode))
(add-hook 'rjsx-mode-hook #'my-js-mode-hook) ;; (add-hook 'rjsx-mode-hook #'my-js-mode-hook)
;; ================================================================= ;; =================================================================

View file

@ -50,7 +50,7 @@
((sequence "TODO" "|" "DONE" "ABANDONED" "DEFERRED")))) ((sequence "TODO" "|" "DONE" "ABANDONED" "DEFERRED"))))
'(package-selected-packages '(package-selected-packages
(quote (quote
(mustache-mode clang-format projectile dash-functional mocha add-node-modules-path rjsx-mode xref-js2 js2-refactor company omnisharp geiser cider clojure-mode graphviz-dot-mode multi-term xterm-color thrift markdown-mode tuareg merlin ag use-package flycheck dockerfile-mode js2-mode web-mode zencoding-mode tss switch-window python-mode paredit magit lua-mode go-mode go-autocomplete exec-path-from-shell csharp-mode color-theme-solarized color-theme-monokai auto-complete auto-complete-nxml flymake flyspell json-mode popup ruby-mode company-jedi tide ahg elm-mode monky))) (lsp-ui company-lsp cquery mustache-mode clang-format projectile dash-functional mocha add-node-modules-path rjsx-mode xref-js2 js2-refactor company omnisharp geiser cider clojure-mode graphviz-dot-mode multi-term xterm-color thrift markdown-mode tuareg merlin ag use-package flycheck dockerfile-mode js2-mode web-mode zencoding-mode tss switch-window python-mode paredit magit lua-mode go-mode go-autocomplete exec-path-from-shell csharp-mode color-theme-solarized color-theme-monokai auto-complete auto-complete-nxml flymake flyspell json-mode popup ruby-mode company-jedi tide ahg elm-mode monky)))
'(reb-re-syntax (quote string)) '(reb-re-syntax (quote string))
'(rmail-mail-new-frame t) '(rmail-mail-new-frame t)
'(safe-local-variable-values '(safe-local-variable-values