The Emacs manual describes how you can customize certain variables on a
per-file basis by including a Local Variable block at the end of
the file. So far, you've only seen a functional interface to CC Mode
customization, which is highly inconvenient for use in a Local Variable
block. CC Mode provides two variables that make it easier for you to
customize your style on a per-file basis.
It works via the standard Emacs hook variable
hack-local-variables-hook.
The variable c-file-style can be set to a style name string.
When the file is visited, CC Mode will automatically set the
file's style to this style using c-set-style.
Another variable, c-file-offsets, takes an association list
similar to what is allowed in c-offsets-alist. When the file is
visited, CC Mode will automatically institute these offets using
c-set-offset.
Note that file style settings (i.e. c-file-style) are applied
before file offset settings (i.e. c-file-offsets). Also, if
either of these are set in a file's local variable section, all the
style variable values are made local to that buffer.