Function: c-font-lock-init

c-font-lock-init is a byte-compiled function defined in cc-mode.el.gz.

Signature

(c-font-lock-init)

Documentation

Set up the font-lock variables for using the font-lock support in CC Mode.

This does not load the font-lock package. Use after c-basic-common-init and after cc-fonts has been loaded. This function is called from c-common-init, once per mode initialization.

Probably introduced at or before Emacs version 22.1.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-mode.el.gz
(defun c-font-lock-init ()
  "Set up the font-lock variables for using the font-lock support in CC Mode.
This does not load the font-lock package.  Use after
`c-basic-common-init' and after cc-fonts has been loaded.
This function is called from `c-common-init', once per mode initialization."

  (set (make-local-variable 'font-lock-defaults)
	`(,(if (c-major-mode-is 'awk-mode)
	       ;; awk-mode currently has only one font lock level.
	       'awk-font-lock-keywords
	     (mapcar 'c-mode-symbol
		     '("font-lock-keywords" "font-lock-keywords-1"
		       "font-lock-keywords-2" "font-lock-keywords-3")))
	  nil nil
	  ,c-identifier-syntax-modifications
	  c-beginning-of-syntax
	  (font-lock-mark-block-function
	   . c-mark-function)))

  ;; Prevent `font-lock-default-fontify-region' extending the region it will
  ;; fontify to whole lines by removing `font-lock-extend-region-wholelines'
  ;; from `font-lock-extend-region-functions'.  (Emacs only).  This fixes
  ;; Emacs bug #19669.
  (when (boundp 'font-lock-extend-region-functions)
    (setq font-lock-extend-region-functions
	  (delq 'font-lock-extend-region-wholelines
		font-lock-extend-region-functions)))

  (make-local-variable 'font-lock-fontify-region-function)
  (setq font-lock-fontify-region-function 'c-font-lock-fontify-region)

  (if (featurep 'xemacs)
      (make-local-hook 'font-lock-mode-hook))
  (add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t))