Is there a good way to apply the variables set in .dir-locals.el when
changing into and out of a directory in eshell (or I suppose in other
Emacs shells as well)?
I've tried setting eshell as a mode in the .dir-locals.el file but with
no success. I've also tried to define after-advice on the `cd' function
in eshell, but there doesn't appear to be any means for applying local
variables to a buffer which doesn't have a file-name.
(defadvice cd (after dir-locals-on-cd activate)
"Apply the variables defined in .dir-locals.el when changing
into and outof a directory in eshell."
(hack-dir-local-variables))
Fails because `hack-dir-local-variables' checks that the buffer is
visiting a file before applying the variables.
Is there a supported way to do this?
If not should I write a new function for this?
If so should it be included in the dir-locals.el functionality?
If not is there a reason to only allow setting local variables for
buffers visiting files?