Subject: Order of evaluation in .dir-locals.el

From: Noam Postavsky <[email-masked]>
Date: Sat, 4 Jun 2016 18:02:07 -0400

reassign 17051 emacs,cc-mode
severity 17051 minor
tag 17051 + confirmed
quit

The reason this doesn't work is revealed in the docstring of c-before-hook:

c-before-hack-hook is a compiled Lisp function in ‘cc-mode.el’.

(c-before-hack-hook)

Set the CC Mode style and "offsets" when in the buffer’s local variables.
They are set only when, respectively, the pseudo variables
‘c-file-style’ and ‘c-file-offsets’ are present in the list.

This function is called from the hook ‘before-hack-local-variables-hook’.

Of course `before-hack-local-variables-hook' runs before any local
variables are set, so there is no "correct" order that a user can use
in .dir-locals.el to define a new style: `c-file-style' always applies
before any other variables.