[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/exec-path-from-shell 9def990ba4 069/114: Allow shell to be
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/exec-path-from-shell 9def990ba4 069/114: Allow shell to be set explicitly, and change default resolution rules |
Date: |
Tue, 5 Sep 2023 04:00:01 -0400 (EDT) |
branch: elpa/exec-path-from-shell
commit 9def990ba4c30409a316d5cbf7b02296a394dece
Author: Steve Purcell <steve@sanityinc.com>
Commit: Steve Purcell <steve@sanityinc.com>
Allow shell to be set explicitly, and change default resolution rules
Fixes #59.
The standard variable shell-file-name is now used by default, with
$SHELL as a fallback. Both can also now be overridden by setting
exec-path-from-shell-shell-name.
---
exec-path-from-shell.el | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/exec-path-from-shell.el b/exec-path-from-shell.el
index f35b142d27..d9cd0a234f 100644
--- a/exec-path-from-shell.el
+++ b/exec-path-from-shell.el
@@ -90,6 +90,13 @@ Environment variables should be set in .profile or .zshenv
rather than
:type 'boolean
:group 'exec-path-from-shell)
+(defcustom exec-path-from-shell-shell-name nil
+ "If non-nil, use this shell executable.
+Otherwise, use either `shell-file-name' (if set), or the value of
+the SHELL environment variable."
+ :type 'file
+ :group 'exec-path-from-shell)
+
(defvar exec-path-from-shell-debug nil
"Display debug info when non-nil.")
@@ -98,11 +105,16 @@ Environment variables should be set in .profile or .zshenv
rather than
(concat "\"" (replace-regexp-in-string "\"" "\\\\\"" s) "\""))
(defun exec-path-from-shell--shell ()
- "Return the shell to use."
- (or (getenv "SHELL") (error "SHELL environment variable is unset")))
+ "Return the shell to use.
+See documentation for `exec-path-from-shell-shell-name'."
+ (or
+ exec-path-from-shell-shell-name
+ shell-file-name
+ (getenv "SHELL")
+ (error "SHELL environment variable is unset")))
(defcustom exec-path-from-shell-arguments
- (if (string-match-p "t?csh$" (or (getenv "SHELL") ""))
+ (if (string-match-p "t?csh$" (exec-path-from-shell--shell))
(list "-d")
(list "-l" "-i"))
"Additional arguments to pass to the shell.
@@ -117,13 +129,13 @@ The default value denotes an interactive login shell."
(apply 'message msg args)))
(defun exec-path-from-shell--standard-shell-p (shell)
- "Return non-nil iff SHELL supports the standard ${VAR-default} syntax."
+ "Return non-nil iff the shell supports the standard ${VAR-default} syntax."
(not (string-match "\\(fish\\|t?csh\\)$" shell)))
(defun exec-path-from-shell-printf (str &optional args)
"Return the result of printing STR in the user's shell.
-Executes $SHELL as interactive login shell.
+Executes the shell as interactive login shell.
STR is inserted literally in a single-quoted argument to printf,
and may therefore contain backslashed escape sequences understood
@@ -158,7 +170,7 @@ shell-escaped, so they may contain $ etc."
(defun exec-path-from-shell-getenvs (names)
"Get the environment variables with NAMES from the user's shell.
-Execute $SHELL according to `exec-path-from-shell-arguments'.
+Execute the shell according to `exec-path-from-shell-arguments'.
The result is a list of (NAME . VALUE) pairs."
(let* ((random-default (md5 (format "%s%s%s" (emacs-pid) (random)
(current-time))))
(dollar-names (mapcar (lambda (n) (format "${%s-%s}" n
random-default)) names))
@@ -180,7 +192,7 @@ The result is a list of (NAME . VALUE) pairs."
(defun exec-path-from-shell-getenv (name)
"Get the environment variable NAME from the user's shell.
-Execute $SHELL as interactive login shell, have it output the
+Execute the shell as interactive login shell, have it output the
variable of NAME and return this output as string."
(cdr (assoc name (exec-path-from-shell-getenvs (list name)))))
- [nongnu] elpa/exec-path-from-shell b09a42885c 037/114: tcsh doesn't support the ${VAR-default} syntax, (continued)
- [nongnu] elpa/exec-path-from-shell b09a42885c 037/114: tcsh doesn't support the ${VAR-default} syntax, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell e4af0e9b44 043/114: Add MELPA badges, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell ba09c3419f 046/114: Note necessity of calling `package-initialize` (closes #19), ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell bb20b46f6a 051/114: Treat csh like tcsh (closes #29), ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 673f1fc060 058/114: Better warning message, and allow the check to be suppressed, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 5e80a4159b 059/114: Use a more sane package version placeholder, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell c2ca275d32 061/114: Clarify incompatibility with cmdproxy.exe et al, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 9700a076a9 065/114: Merge pull request #45 from jlandahl/master, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 15d07666fb 074/114: Merge pull request #65 from belak/also-run-on-linux, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell fedb500652 073/114: Fix "Emacssenvironment" typo, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 9def990ba4 069/114: Allow shell to be set explicitly, and change default resolution rules,
ELPA Syncer <=
- [nongnu] elpa/exec-path-from-shell 5c44eabbb0 080/114: Declare a variable for the byte compiler, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 54ea2f9c3c 082/114: Make clear that bash and zsh are particularly supported, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 7e7f381884 091/114: Use a better method to establish definition of eshell-path-env, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 1a43e8aea5 090/114: Add simple CI with Actions, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 9365c94ef1 096/114: Clarify point in README, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 4ea306a76f 103/114: Prefer cl-gensym to gensym for better compatibility across emacs versions, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell e5647b9109 099/114: Add Emacs 27.1 to CI, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell d8824a3a4e 104/114: Set each instance of the buffer local variable eshell-path-env, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell d14d6d2966 106/114: Merge pull request #101 from mnewt/eshell-path-env-in-buffers, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell bf4bdc8b89 107/114: Add Emacs 27.2 to CI matrix, ELPA Syncer, 2023/09/05