I observed that directory local variables, defined in .dir-locals.el, are set for files, dired-buffers, new buffers, but not for shell or eshell buffers (well, that is also the case for buffers generated with get-buffer-create or generate-new-buffer and surely a ton of other similar functions).

My question now is, how would I trigger the search and evaluation of .dir-locals.el, so I could do this in an around advice? Or can I somehow enable it for shell and shell-command?

  • 1
    I've not tried this, but from reading the documentation, you want to look at shell-dirtrack-mode (for staying up-to-date on the value of current directory in shell) and its hook functions like shell-process-popd, shell-process-pushd and shell-process-cd.
    – wvxvw
    Dec 8, 2016 at 9:31


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.