mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
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:
@ -13,5 +13,12 @@ buffer/window/frame switch, which is less expensive."
|
|||||||
(add-hook 'focus-in-hook #'direnv--maybe-update-environment)))
|
(add-hook 'focus-in-hook #'direnv--maybe-update-environment)))
|
||||||
(add-hook 'direnv-mode-hook #'+direnv|init)
|
(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")
|
(when (executable-find "direnv")
|
||||||
(direnv-mode +1)))
|
(direnv-mode +1)))
|
||||||
|
Reference in New Issue
Block a user