branch: elpa/exec-path-from-shell
commit 6be6e33bbe735ebba64a0feab346076a3703b938
Author: Steve Purcell <[email protected]>
Commit: Steve Purcell <[email protected]>
Demote the warning to a message
---
exec-path-from-shell.el | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/exec-path-from-shell.el b/exec-path-from-shell.el
index 315b0d3683..8e72442e01 100644
--- a/exec-path-from-shell.el
+++ b/exec-path-from-shell.el
@@ -188,23 +188,25 @@ variables such as `exec-path'."
As a special case, if the variable is $PATH, then `exec-path' and
`eshell-path-env' are also set appropriately. The result is an alist,
as described by `exec-path-from-shell-getenvs'."
- (let ((pairs (exec-path-from-shell-getenvs names))
- (without-minus-i (remove "-i" exec-path-from-shell-arguments)))
+ (let ((pairs (exec-path-from-shell-getenvs names)))
+ (exec-path-from-shell--maybe-warn-about-startup-files pairs)
+ (mapc (lambda (pair)
+ (exec-path-from-shell-setenv (car pair) (cdr pair)))
+ pairs)))
+(defun exec-path-from-shell--maybe-warn-about-startup-files (pairs)
+ "Warn the user if the value of PAIRS seems to depend on interactive shell
startup files."
+ (let ((without-minus-i (remove "-i" exec-path-from-shell-arguments)))
;; If the user is using "-i", we warn them if it is necessary.
(unless (eq exec-path-from-shell-arguments without-minus-i)
(let* ((exec-path-from-shell-arguments without-minus-i)
- (alt-pairs (exec-path-from-shell-getenvs names))
+ (alt-pairs (exec-path-from-shell-getenvs (mapcar 'car pairs)))
different)
(dolist (pair pairs)
(unless (equal pair (assoc (car pair) alt-pairs))
(push (car pair) different)))
(when different
- (warn "You appear to be setting environment variables %S in your
.bashrc or .zshrc: those files are only read by interactive shells, so you
should instead set environment variables in startup files like .bash_profile or
.zshenv. Refer to your shell's man page for more info. In future,
exec-path-from-shell will not read variables set in the wrong files."
different))))
-
- (mapc (lambda (pair)
- (exec-path-from-shell-setenv (car pair) (cdr pair)))
- pairs)))
+ (message "You appear to be setting environment variables %S in your
.bashrc or .zshrc: those files are only read by interactive shells, so you
should instead set environment variables in startup files like .bash_profile or
.zshenv. Refer to your shell's man page for more info. In future,
exec-path-from-shell will not read variables set in the wrong files."
different))))))
;;;###autoload
(defun exec-path-from-shell-copy-env (name)