tools/direnv: fix direnv+flycheck integration
Also fixes direnv+flycheck for nix users by consulting direnv before looking for flycheck executables.
This commit is contained in:
parent
c3c282f0a4
commit
ef8cd55234
1 changed files with 7 additions and 0 deletions
|
@ -13,5 +13,12 @@ buffer/window/frame switch, which is less expensive."
|
|||
(add-hook 'focus-in-hook #'direnv--maybe-update-environment)))
|
||||
(add-hook 'direnv-mode-hook #'+direnv|init)
|
||||
|
||||
(defun +direnv*update (&rest _)
|
||||
"Update direnv. Useful to advise functions that may run
|
||||
environment-sensitive logic like `flycheck-default-executable-find'. This fixes
|
||||
flycheck issues with direnv and on nix."
|
||||
(direnv-update-environment default-directory))
|
||||
(advice-add #'flycheck-default-executable-find :before #'+direnv*update)
|
||||
|
||||
(when (executable-find "direnv")
|
||||
(direnv-mode +1)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue