Function: c-postprocess-file-styles
c-postprocess-file-styles is a byte-compiled function defined in
cc-mode.el.gz.
Signature
(c-postprocess-file-styles)
Documentation
Function that post processes relevant file local variables in CC Mode.
Currently, this function simply applies any style and offset settings
found in the file's Local Variable list. It first applies any style
setting found in c-file-style, then it applies any offset settings
it finds in c-file-offsets.
Note that the style variables are always made local to the buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-mode.el.gz
(defun c-postprocess-file-styles ()
"Function that post processes relevant file local variables in CC Mode.
Currently, this function simply applies any style and offset settings
found in the file's Local Variable list. It first applies any style
setting found in `c-file-style', then it applies any offset settings
it finds in `c-file-offsets'.
Note that the style variables are always made local to the buffer."
;; apply file styles and offsets
(when c-buffer-is-cc-mode
(if (or c-file-style c-file-offsets)
(c-make-styles-buffer-local t))
(when c-file-style
(or (stringp c-file-style)
(error "c-file-style is not a string"))
(c-set-style c-file-style))
(and c-file-offsets
(mapc
(lambda (langentry)
(let ((langelem (car langentry))
(offset (cdr langentry)))
(c-set-offset langelem offset)))
c-file-offsets))
;; Problem: The file local variable block might have explicitly set a
;; style variable. The `c-set-style' or `mapcar' call might have
;; overwritten this. So we run `hack-local-variables' again to remedy
;; this. There are no guarantees this will work properly, particularly as
;; we have no control over what the other hook functions on
;; `hack-local-variables-hook' would have done. We now (2006/2/1) remove
;; any `eval' or `mode' expressions before we evaluate again (see below).
;; ACM, 2005/11/2.
;;
;; Problem (bug reported by Gustav Broberg): if one of the variables is
;; `mode', this will invoke c-mode (etc.) again, setting up the style etc.
;; We prevent this by temporarily removing `mode' from the Local Variables
;; section.
(if (or c-file-style c-file-offsets)
(let ((hack-local-variables-hook nil) (inhibit-read-only t))
(c-tentative-buffer-changes
(c-remove-any-local-eval-or-mode-variables)
(hack-local-variables))
nil))))