[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CC Mode, labels not fontified
From: |
Chong Yidong |
Subject: |
Re: CC Mode, labels not fontified |
Date: |
Thu, 29 Mar 2007 23:22:42 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.96 (gnu/linux) |
address@hidden (Johan Bockgård) writes:
> $ emacs -Q +2956 .../emacs/src/eval.c
>
> The `retry:' label is not highlighted. It is fontified correctly by
> `M-o M-o' though.
Simon, this appears to be the result of your change. Could you try to
fix your patch?
2006-11-10 Simon Marshall <address@hidden>
* progmodes/cc-fonts.el (c-font-lock-declarations): Don't overwrite
fontification for "case" and "default" keywords.
*** emacs/lisp/progmodes/cc-fonts.el 2006/07/10 13:17:09 1.16
--- emacs/lisp/progmodes/cc-fonts.el 2006/11/10 16:58:27 1.17
***************
*** 1170,1190 ****
(c-fontify-recorded-types-and-refs)
nil))
! ;; It was a false alarm. Check if we're in a label instead.
(goto-char start-pos)
! (when (c-forward-label t match-pos nil)
! ;; Can't use `c-fontify-types-and-refs' here since we
! ;; should use the label face.
! (let (elem)
! (while c-record-ref-identifiers
! (setq elem (car c-record-ref-identifiers)
! c-record-ref-identifiers (cdr c-record-ref-identifiers))
! (c-put-font-lock-face (car elem) (cdr elem)
! c-label-face-name)))
! ;; `c-forward-label' probably has added a `c-decl-end'
! ;; marker, so return t to `c-find-decl-spots' to signal
! ;; that.
! t))))
nil)))
--- 1170,1208 ----
(c-fontify-recorded-types-and-refs)
nil))
! ;; It was a false alarm.
(goto-char start-pos)
! ;; The below code attempts to fontify the case constants in
! ;; c-label-face-name, but it cannot catch every case [sic].
! ;; And do we want to fontify case constants anyway?
! nil
! ;;; (when (c-forward-label t match-pos nil)
! ;;; ;; Can't use `c-fontify-types-and-refs' here since we
! ;;; ;; should use the label face.
! ;;; (save-excursion
! ;;; (while c-record-ref-identifiers
! ;;; (let ((elem (car c-record-ref-identifiers))
! ;;; c-record-type-identifiers)
! ;;; (goto-char (cdr elem))
! ;;; ;; Find the end of any label.
! ;;; (while (and (re-search-forward "\\sw\\|:" nil t)
! ;;; (progn (backward-char 1) t)
! ;;; (or (re-search-forward
! ;;; "\\=0[Xx][0-9A-Fa-f]+\\|\\([0-9]+\\)" nil t)
! ;;; (c-forward-name)))
! ;;; (c-backward-syntactic-ws)
! ;;; (let ((end (point)))
! ;;; ;; Now find the start of the bit we regard as the label.
! ;;; (when (and (c-simple-skip-symbol-backward)
! ;;; (not (c-get-char-property (point) 'face)))
! ;;; (c-put-font-lock-face (point) end c-label-face-name))
! ;;; (goto-char end))))
! ;;; (setq c-record-ref-identifiers (cdr c-record-ref-identifiers))))
! ;;; ;; `c-forward-label' probably has added a `c-decl-end'
! ;;; ;; marker, so return t to `c-find-decl-spots' to signal
! ;;; ;; that.
! ;;; t)
! )))
nil)))