tools/direnv: fix async-shell-command

This commit is contained in:
Henrik Lissner 2019-12-01 05:13:54 -05:00
parent c7a6cf8403
commit 3743bc70ab
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -54,4 +54,16 @@ flycheck issues with direnv and on nix."
(funcall orig-fn)) (funcall orig-fn))
(doom-log "Couldn't find direnv executable"))) (doom-log "Couldn't find direnv executable")))
(defadvice! +direnv-update-async-shell-command-a (command &optional output-buffer _error-buffer)
:before #'shell-command
(when (string-match "[ \t]*&[ \t]*\\'" command)
(let ((environment process-environment)
(path exec-path)
(shell shell-file-name))
(with-current-buffer
(get-buffer-create (or output-buffer "*Async Shell Command*"))
(setq-local process-environment environment)
(setq-local exec-path path)
(setq-local shell-file-name shell)))))
(direnv-mode +1)) (direnv-mode +1))