;;; .dir-locals.el
((nil
(eval add-hook 'find-file-hook (lambda ()
(message "my find-file hook called...")) nil t)))
The nil
means this applies to all files in the directories bellow .dir-locals.el
.
The t
passed to add-hook
makes find-file-hook
buffer-local. Therefore the hook runs only for this file.
dir-locals
runs before find-file-hook
, so the whole thing works.