I am inexperienced in Emacs and very new to directory-local variables, so please forgive any obvious things I may be missing.
I am trying to have auto-fill mode activated for all the files in a certain directory. In this directory, I have a .dir-locals.el
file which contains:
((nil . ((eval add-hook 'text-mode-hook 'turn-on-auto-fill)
(truncate-lines . nil)))
)
(FYI I have truncate-lines
set to t
in my .emacs
file, so that's its "default" value for me.)
After saving this .dir-locals.el
file, when opening a text file with Emacs in this directory, I find that truncate-lines
is indeed turned off. However, auto-fill
isn't working: the lines I'm writing don't break into new lines. (My fill-column
value is 70.)
When I do C-h v text-mode-hook
I get:
text-mode-hook's value is
(turn-on-auto-fill text-mode-hook-identify)
...
but when I don't include the "eval add-hook
..." in the .dir-locals.el
file, the words turn-on-auto-fill
don't appear in the text-mode-hook
's value, so the .el
file I have appears to be setting something, it just isn't working.
When I do M-x auto-fill-mode
, then auto-fill
does start working.
Any ideas why auto-fill
isn't working for me from my directory local file? Alternatively, any suggestions for an alternative way to active auto-fill-mode
for and only for the files in my directory?