diff options
Diffstat (limited to 'lisp/progmodes/cc-fonts.el')
-rw-r--r-- | lisp/progmodes/cc-fonts.el | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 2e71285cb36..b4ff32b9070 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1141,12 +1141,28 @@ casts and declarations are fontified. Used on level 2 and higher." (while (and (< (point) id-end) (re-search-forward c-opt-identifier-prefix-key id-end t)) (c-forward-syntactic-ws limit)))) - (when (not (get-text-property (point) 'face)) + ;; Only apply the face when the text doesn't have one yet. + ;; Exception: The "" in C++'s operator"" will already wrongly have + ;; string face. + (when (memq (get-text-property (point) 'face) + '(nil font-lock-string-face)) (c-put-font-lock-face (point) id-end (cond ((not (memq types '(nil t))) types) (is-function 'font-lock-function-name-face) - (t 'font-lock-variable-name-face)))))) + (t 'font-lock-variable-name-face)))) + ;; Fontify any _tag in C++'s operator"" _tag. + (when (and + (c-major-mode-is 'c++-mode) + (equal (buffer-substring-no-properties id-start id-end) + "\"\"")) + (goto-char id-end) + (c-forward-syntactic-ws limit) + (when (c-on-identifier) + (c-put-font-lock-face + (point) + (progn (c-forward-over-token) (point)) + font-lock-function-name-face))))) (and template-class (eq init-char ?=) ; C++ "<class X = Y>"? (progn |