emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/exec-path-from-shell 673f1fc060 058/114: Better warning me


From: ELPA Syncer
Subject: [nongnu] elpa/exec-path-from-shell 673f1fc060 058/114: Better warning message, and allow the check to be suppressed
Date: Tue, 5 Sep 2023 04:00:00 -0400 (EDT)

branch: elpa/exec-path-from-shell
commit 673f1fc0606ca9a30eb62cb1ac2094d15ab9377e
Author: Steve Purcell <steve@sanityinc.com>
Commit: Steve Purcell <steve@sanityinc.com>

    Better warning message, and allow the check to be suppressed
---
 exec-path-from-shell.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/exec-path-from-shell.el b/exec-path-from-shell.el
index 8e72442e01..dbf89a8270 100644
--- a/exec-path-from-shell.el
+++ b/exec-path-from-shell.el
@@ -82,6 +82,13 @@
   :type '(repeat (string :tag "Environment variable"))
   :group 'exec-path-from-shell)
 
+(defcustom exec-path-from-shell-check-startup-files t
+  "If non-nil, warn if variables are being set in the wrong shell startup 
files.
+Environment variables should be set in .profile or .zshenv rather than
+.bashrc or .zshrc."
+  :type 'boolean
+  :group 'exec-path-from-shell)
+
 (defvar exec-path-from-shell-debug nil
   "Display debug info when non-nil.")
 
@@ -189,7 +196,8 @@ 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)))
-    (exec-path-from-shell--maybe-warn-about-startup-files pairs)
+    (when exec-path-from-shell-check-startup-files
+      (exec-path-from-shell--maybe-warn-about-startup-files pairs))
     (mapc (lambda (pair)
             (exec-path-from-shell-setenv (car pair) (cdr pair)))
           pairs)))
@@ -206,7 +214,7 @@ as described by `exec-path-from-shell-getenvs'."
           (unless (equal pair (assoc (car pair) alt-pairs))
             (push (car pair) different)))
         (when different
-          (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))))))
+          (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 .profile, 
.bash_profile or .zshenv.  Refer to your shell's man page for more info.  
Customize `exec-path-from-shell-arguments' to remove \"-i\" when done, or 
disable `exec-path-from-shell-check-startup-files' to disable this message." 
different))))))
 
 ;;;###autoload
 (defun exec-path-from-shell-copy-env (name)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]