+(defun c-font-lock-cut-off-declarators (limit)
+ ;; Fontify any declarators "cut off" from their declaring type at the start
+ ;; of the region being fontified.
+ ;;
+ ;; This function will be called from font-lock- for a region bounded by
+ ;; POINT and LIMIT, as though it were to identify a keyword for
+ ;; font-lock-keyword-face. It always returns NIL to inhibit this and
+ ;; prevent a repeat invocation. See elisp/lispref page "Search-based
+ ;; fontification".
+ (let ((decl-search-lim (c-determine-limit 1000))
+ paren-state bod-res is-typedef encl-pos
+ c-recognize-knr-p) ; Strictly speaking, bogus, but it
+ ; speeds up lisp.h tremendously.
+ (save-excursion
+ (when (not (c-back-over-member-initializers))
+ (unless (or (eobp)
+ (looking-at "\\s(\\|\\s)"))
+ (forward-char))
+ (setq bod-res (car (c-beginning-of-decl-1 decl-search-lim)))
+ (if (and (eq bod-res 'same)
+ (save-excursion
+ (c-backward-syntactic-ws)
+ (eq (char-before) ?\})))
+ (c-beginning-of-decl-1 decl-search-lim))
+
+ ;; We're now putatively at the declaration.
+ (setq paren-state (c-parse-state))
+ ;; At top level or inside a "{"?
+ (if (or (not (setq encl-pos
+ (c-most-enclosing-brace paren-state)))
+ (eq (char-after encl-pos) ?\{))
+ (progn
+ (when (looking-at c-typedef-key) ; "typedef"
+ (setq is-typedef t)
+ (goto-char (match-end 0))
+ (c-forward-syntactic-ws))
+ ;; At a real declaration?
+ (if (memq (c-forward-type t) '(t known found decltype))
+ (c-font-lock-declarators (point-max) t is-typedef)))
+ nil)))))
+