[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Wed, 07 Jan 2009 20:04:23 -0700
Thunderbird 18.104.22.168 (Macintosh/20081209)
Eric Schulte wrote:
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."
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?
I don't know. But you should be able to get your advice to work by
let-binding buffer-file-name to default-directory around the call to
Or perhaps to (expand-file-name "foo").
Denver, Colorado, USA