Pull environment vars from direnv into Cider repls

This commit is contained in:
Jeremy Dormitzer 2019-07-19 10:39:59 -04:00
parent 175d2d547e
commit fbd05357f2

View File

@ -2621,12 +2621,15 @@ The Emacs Multi-Media System. For libtag to work, libtag must be installed on th
* Direnv
[[https://direnv.net/][Direnv]] automatically runs bash scripts when you enter certain directories. This sets it up to work with Emacs:
#+BEGIN_SRC emacs-lisp
(defun update-cider-env ()
(direnv-update-directory-environment nrepl-project-dir))
(use-package direnv
:if (executable-find "direnv")
:config (direnv-mode)
(add-hook 'eshell-mode-hook #'direnv-update-directory-environment)
(add-hook 'eshell-directory-change-hook #'direnv-update-directory-environment)
(add-buffer-mode-hook 'cider-repl-mode (lambda () (direnv-update-directory-environment nrepl-project-dir))))
(add-buffer-mode-hook 'cider-repl-mode #'update-cider-env))
#+END_SRC
* SQL
Emacs has excellent built-in SQL support.