Function: font-latex-setup
font-latex-setup is an autoloaded and byte-compiled function defined
in font-latex.el.
Signature
(font-latex-setup)
Documentation
Setup this buffer for LaTeX font-lock. Usually called from a hook.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/font-latex.el
;;;###autoload
(defun font-latex-setup ()
"Setup this buffer for LaTeX font-lock. Usually called from a hook."
(font-latex-set-syntactic-keywords)
;; Activate multi-line fontification facilities.
(setq-local font-lock-multiline t)
;; The test for `major-mode' currently only works with docTeX mode
;; because `TeX-install-font-lock' is called explicitly in
;; `docTeX-mode'. In case other modes have to be distinguished as
;; well, remove the call to `TeX-install-font-lock' from `TeX-mode'
;; and place it in the different `xxx-mode' calls instead, but
;; _after_ `major-mode' is set.
(let ((defaults
`((font-latex-keywords font-latex-keywords-1 font-latex-keywords-2)
nil nil ,font-latex-syntax-alist nil))
(variables
'((font-lock-mark-block-function . mark-paragraph)
(font-lock-fontify-region-function
. font-latex-fontify-region)
(font-lock-unfontify-region-function
. font-latex-unfontify-region)
(font-lock-extend-region-functions
font-lock-extend-region-wholelines
font-lock-extend-region-multiline
font-latex-extend-region-backwards-command-with-args
font-latex-extend-region-backwards-command-in-braces
font-latex-extend-region-backwards-quotation
font-latex-extend-region-backwards-math)
(syntax-propertize-extend-region-functions
syntax-propertize-wholelines
font-latex-sp-extend-region-backwards-verb-env))))
;; Add the mode-dependent stuff to the basic variables defined above.
(if (eq major-mode 'docTeX-mode)
(progn
(setcar defaults (append (car defaults)
'(font-latex-doctex-keywords)))
(setq variables
(append variables
'((font-lock-syntactic-face-function
. font-latex-doctex-syntactic-face-function)))))
(setq variables
(append variables
'((font-lock-syntactic-face-function
. font-latex-syntactic-face-function)))))
;; Set the defaults.
(setq font-lock-defaults (append defaults variables)))
;; Make sure fontification will be refreshed if a user sets variables
;; influencing fontification in her file-local variables section.
(add-hook 'hack-local-variables-hook #'font-latex-after-hacking-local-variables t t)
;; We may be using the mode programmatically to extract data, and we
;; then need this to be set up first so that a command like
;; `xref-find-references' doesn't bug out when matching hits in
;; files that Emacs isn't visiting. (bug#65912)
;; We need this treatment because the current syntax propertize
;; facility depends on font lock machinery. We can remove this
;; when syntax propertization decouples font lock.
(unless buffer-file-truename
(font-lock-set-defaults)))