Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion envrc.el
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ Messages are written into the *envrc-debug* buffer."
:group 'envrc
:type 'boolean)

(defcustom envrc-disable-in-minibuffer nil
"Whether or not to load environments in the minibuffer.

A non-nil value will prevent the envrionment from propagating into the
minibuffer. Note that `completing-read' will not provide completion
using the new environment."
:group 'envrc
:type 'boolean)

(defcustom envrc-direnv-executable "direnv"
"The direnv executable used by envrc."
:type 'string)
Expand Down Expand Up @@ -154,7 +163,7 @@ e.g. (define-key envrc-mode-map (kbd \"C-c e\") \\='envrc-command-map)"
(lambda ()
(when
(cond
((minibufferp) nil)
((and (minibufferp) envrc-disable-in-minibuffer) nil)
((file-remote-p default-directory)
(and envrc-remote
(seq-contains-p
Expand Down Expand Up @@ -513,6 +522,10 @@ Shortcuts tramp caching direnv sets the exec-path."
(or envrc--remote-path
(apply fn vec nil))))

;; NOTE: since this function is meant to be invoked by `completing-read',
;; `envrc-mode' must be enabled in the minibuffer. This can be configured by
;; setting `envrc-disable-in-minibuffer' to nil.
(advice-add 'Man-completion-table :around #'envrc-propagate-environment)
(advice-add 'shell-command-to-string :around #'envrc-propagate-environment)
(advice-add 'async-shell-command :around #'envrc-propagate-environment)
(advice-add 'org-babel-eval :around #'envrc-propagate-environment)
Expand Down
Loading