Refactor C++11 highlights
This commit is contained in:
parent
4e18316d1d
commit
cd73c8585d
2 changed files with 17 additions and 16 deletions
|
@ -23,8 +23,24 @@
|
||||||
;; DEL mapping interferes with smartparens and my custom DEL binding
|
;; DEL mapping interferes with smartparens and my custom DEL binding
|
||||||
(define-key c-mode-map (kbd "DEL") nil))
|
(define-key c-mode-map (kbd "DEL") nil))
|
||||||
|
|
||||||
|
(defun narf--copy-face (new-face face)
|
||||||
|
"Define NEW-FACE from existing FACE."
|
||||||
|
(copy-face face new-face)
|
||||||
|
(eval `(defvar ,new-face nil))
|
||||||
|
(set new-face new-face))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun narf|init-c++-C11-highlights ()
|
(defun narf|init-c++-C11-highlights ()
|
||||||
|
;; C++11 syntax support (until cc-mode is updated)
|
||||||
|
(require 'font-lock)
|
||||||
|
;; labels, case, public, private, protected, namespace-tags
|
||||||
|
(narf--copy-face 'font-lock-label-face 'font-lock-keyword-face)
|
||||||
|
;; comment markups such as Javadoc-tags
|
||||||
|
(narf--copy-face 'font-lock-doc-markup-face 'font-lock-doc-face)
|
||||||
|
;; comment markups
|
||||||
|
(narf--copy-face 'font-lock-doc-string-face 'font-lock-comment-face)
|
||||||
|
(setq font-lock-maximum-decoration t)
|
||||||
|
|
||||||
;; We could place some regexes into `c-mode-common-hook', but
|
;; We could place some regexes into `c-mode-common-hook', but
|
||||||
;; note that their evaluation order matters.
|
;; note that their evaluation order matters.
|
||||||
(font-lock-add-keywords
|
(font-lock-add-keywords
|
||||||
|
|
|
@ -44,25 +44,10 @@
|
||||||
(add-company-backend! objc-mode (c-headers xcode)))
|
(add-company-backend! objc-mode (c-headers xcode)))
|
||||||
|
|
||||||
(add-hook! (c-mode c++-mode) 'narf|init-c/c++-settings)
|
(add-hook! (c-mode c++-mode) 'narf|init-c/c++-settings)
|
||||||
|
(add-hook! c++-mode 'narf|init-c++-C11-highlights)
|
||||||
(add-hook! c++-mode (setq flycheck-clang-language-standard "c++11"
|
(add-hook! c++-mode (setq flycheck-clang-language-standard "c++11"
|
||||||
flycheck-clang-standard-library "libc++"))
|
flycheck-clang-standard-library "libc++"))
|
||||||
|
|
||||||
;; C++11 syntax support (until cc-mode is updated)
|
|
||||||
(require 'font-lock)
|
|
||||||
(defun --copy-face (new-face face)
|
|
||||||
"Define NEW-FACE from existing FACE."
|
|
||||||
(copy-face face new-face)
|
|
||||||
(eval `(defvar ,new-face nil))
|
|
||||||
(set new-face new-face))
|
|
||||||
;; labels, case, public, private, protected, namespace-tags
|
|
||||||
(--copy-face 'font-lock-label-face 'font-lock-keyword-face)
|
|
||||||
;; comment markups such as Javadoc-tags
|
|
||||||
(--copy-face 'font-lock-doc-markup-face 'font-lock-doc-face)
|
|
||||||
;; comment markups
|
|
||||||
(--copy-face 'font-lock-doc-string-face 'font-lock-comment-face)
|
|
||||||
(setq font-lock-maximum-decoration t)
|
|
||||||
(add-hook! c++-mode 'narf|init-c++-C11-highlights)
|
|
||||||
|
|
||||||
;; Fix enum and C++11 lambda indentation
|
;; Fix enum and C++11 lambda indentation
|
||||||
(defadvice c-lineup-arglist (around c-lineup-arglist-indent-fix activate)
|
(defadvice c-lineup-arglist (around c-lineup-arglist-indent-fix activate)
|
||||||
"Improve indentation of continued C++11 lambda function opened as argument."
|
"Improve indentation of continued C++11 lambda function opened as argument."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue