Correct indentation of ids in a C++ enum after a protection keyword.
Also correct the misfontification of the last enum identifier. * lisp/progmodes/cc-engine.el (c-forward-keyword-prefixed-id): setq c-last-identifier-range to nil to ensure that only types recognized by this macro are set for fontification as types. (c-backward-typed-enum-colon): Function renamed from c-backward-colon-prefixed-type. On finding a colon in the backward search, check it is preceded by an identifier rather than a keyword.
This commit is contained in:
parent
5c3534ffdc
commit
48b24c9b03
1 changed files with 11 additions and 7 deletions
|
@ -5806,6 +5806,7 @@ comment at the start of cc-engine.el for more info."
|
||||||
;;
|
;;
|
||||||
;; This macro might do hidden buffer changes.
|
;; This macro might do hidden buffer changes.
|
||||||
`(let (res)
|
`(let (res)
|
||||||
|
(setq c-last-identifier-range nil)
|
||||||
(while (if (setq res ,(if (eq type 'type)
|
(while (if (setq res ,(if (eq type 'type)
|
||||||
`(c-forward-type)
|
`(c-forward-type)
|
||||||
`(c-forward-name)))
|
`(c-forward-name)))
|
||||||
|
@ -8928,11 +8929,11 @@ comment at the start of cc-engine.el for more info."
|
||||||
(not (looking-at "=")))))
|
(not (looking-at "=")))))
|
||||||
b-pos)))
|
b-pos)))
|
||||||
|
|
||||||
(defun c-backward-colon-prefixed-type ()
|
(defun c-backward-typed-enum-colon ()
|
||||||
;; We're at the token after what might be a type prefixed with a colon. Try
|
;; We're at a "{" which might be the opening brace of a enum which is
|
||||||
;; moving backward over this type and the colon. On success, return t and
|
;; strongly typed (by a ":" followed by a type). If this is the case, leave
|
||||||
;; leave point before colon; on failure, leave point unchanged. Will clobber
|
;; point before the colon and return t. Otherwise leave point unchanged and return nil.
|
||||||
;; match data.
|
;; Match data will be clobbered.
|
||||||
(let ((here (point))
|
(let ((here (point))
|
||||||
(colon-pos nil))
|
(colon-pos nil))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
@ -8941,7 +8942,10 @@ comment at the start of cc-engine.el for more info."
|
||||||
(or (not (looking-at "\\s)"))
|
(or (not (looking-at "\\s)"))
|
||||||
(c-go-up-list-backward))
|
(c-go-up-list-backward))
|
||||||
(cond
|
(cond
|
||||||
((eql (char-after) ?:)
|
((and (eql (char-after) ?:)
|
||||||
|
(save-excursion
|
||||||
|
(c-backward-syntactic-ws)
|
||||||
|
(c-on-identifier)))
|
||||||
(setq colon-pos (point))
|
(setq colon-pos (point))
|
||||||
(forward-char)
|
(forward-char)
|
||||||
(c-forward-syntactic-ws)
|
(c-forward-syntactic-ws)
|
||||||
|
@ -8965,7 +8969,7 @@ comment at the start of cc-engine.el for more info."
|
||||||
(let ((here (point))
|
(let ((here (point))
|
||||||
up-sexp-pos before-identifier)
|
up-sexp-pos before-identifier)
|
||||||
(when c-recognize-post-brace-list-type-p
|
(when c-recognize-post-brace-list-type-p
|
||||||
(c-backward-colon-prefixed-type))
|
(c-backward-typed-enum-colon))
|
||||||
(while
|
(while
|
||||||
(and
|
(and
|
||||||
(eq (c-backward-token-2) 0)
|
(eq (c-backward-token-2) 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue