emacs-direnv
emacs-direnv copied to clipboard
Update environment earlier
This PR should fix #17 and #28.
The problems are firstly, before-hack-local-variables-hook
doesn't get run if the file has not file local variables, and secondly post-command-hook
is run after all the major mode hooks. If any major mode hooks expects exec-path
to be the most updated value, the current implementation does not work for this expectation. It also runs too frequently unnecessarily.
To update the environment as early as possible, this PR moves the decision to just before the major mode hooks are run but after the major mode has been set up, after a window buffer change and after a window is selected.
In addition, this PR resets the environment to the HOME
dir's whenever the user selects a non-file and non-whitelisted window buffer so as to mitigate the perception problem that justified the entire existence of this package.