diff options
| author | Chong Yidong | 2006-11-10 16:58:27 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-11-10 16:58:27 +0000 |
| commit | 97bd827ab200f1f3e9d9266ae5cc457baee22909 (patch) | |
| tree | 8de5e71555c2339ef3c364fd42ffd73a4eabe174 | |
| parent | 719106a318d84561d21f06411f8a93a3d9975ed3 (diff) | |
| download | emacs-97bd827ab200f1f3e9d9266ae5cc457baee22909.tar.gz emacs-97bd827ab200f1f3e9d9266ae5cc457baee22909.zip | |
(c-font-lock-declarations): Don't overwrite fontification for "case"
and "default" keywords.
| -rw-r--r-- | lisp/progmodes/cc-fonts.el | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 9c051506888..d8fd78af44d 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el | |||
| @@ -1170,21 +1170,39 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1170 | (c-fontify-recorded-types-and-refs) | 1170 | (c-fontify-recorded-types-and-refs) |
| 1171 | nil)) | 1171 | nil)) |
| 1172 | 1172 | ||
| 1173 | ;; It was a false alarm. Check if we're in a label instead. | 1173 | ;; It was a false alarm. |
| 1174 | (goto-char start-pos) | 1174 | (goto-char start-pos) |
| 1175 | (when (c-forward-label t match-pos nil) | 1175 | ;; The below code attempts to fontify the case constants in |
| 1176 | ;; Can't use `c-fontify-types-and-refs' here since we | 1176 | ;; c-label-face-name, but it cannot catch every case [sic]. |
| 1177 | ;; should use the label face. | 1177 | ;; And do we want to fontify case constants anyway? |
| 1178 | (let (elem) | 1178 | nil |
| 1179 | (while c-record-ref-identifiers | 1179 | ;;; (when (c-forward-label t match-pos nil) |
| 1180 | (setq elem (car c-record-ref-identifiers) | 1180 | ;;; ;; Can't use `c-fontify-types-and-refs' here since we |
| 1181 | c-record-ref-identifiers (cdr c-record-ref-identifiers)) | 1181 | ;;; ;; should use the label face. |
| 1182 | (c-put-font-lock-face (car elem) (cdr elem) | 1182 | ;;; (save-excursion |
| 1183 | c-label-face-name))) | 1183 | ;;; (while c-record-ref-identifiers |
| 1184 | ;; `c-forward-label' probably has added a `c-decl-end' | 1184 | ;;; (let ((elem (car c-record-ref-identifiers)) |
| 1185 | ;; marker, so return t to `c-find-decl-spots' to signal | 1185 | ;;; c-record-type-identifiers) |
| 1186 | ;; that. | 1186 | ;;; (goto-char (cdr elem)) |
| 1187 | t)))) | 1187 | ;;; ;; Find the end of any label. |
| 1188 | ;;; (while (and (re-search-forward "\\sw\\|:" nil t) | ||
| 1189 | ;;; (progn (backward-char 1) t) | ||
| 1190 | ;;; (or (re-search-forward | ||
| 1191 | ;;; "\\=0[Xx][0-9A-Fa-f]+\\|\\([0-9]+\\)" nil t) | ||
| 1192 | ;;; (c-forward-name))) | ||
| 1193 | ;;; (c-backward-syntactic-ws) | ||
| 1194 | ;;; (let ((end (point))) | ||
| 1195 | ;;; ;; Now find the start of the bit we regard as the label. | ||
| 1196 | ;;; (when (and (c-simple-skip-symbol-backward) | ||
| 1197 | ;;; (not (c-get-char-property (point) 'face))) | ||
| 1198 | ;;; (c-put-font-lock-face (point) end c-label-face-name)) | ||
| 1199 | ;;; (goto-char end)))) | ||
| 1200 | ;;; (setq c-record-ref-identifiers (cdr c-record-ref-identifiers)))) | ||
| 1201 | ;;; ;; `c-forward-label' probably has added a `c-decl-end' | ||
| 1202 | ;;; ;; marker, so return t to `c-find-decl-spots' to signal | ||
| 1203 | ;;; ;; that. | ||
| 1204 | ;;; t) | ||
| 1205 | ))) | ||
| 1188 | 1206 | ||
| 1189 | nil))) | 1207 | nil))) |
| 1190 | 1208 | ||