summaryrefslogtreecommitdiff
path: root/lisp/eshell/esh-var.el
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2022-09-15 12:24:37 -0700
committerJim Porter <jporterbugs@gmail.com>2022-10-17 18:48:52 -0700
commitcee1cbfd54375cdece23d4741ced6b0c7091f6d9 (patch)
tree482d4bf98473742958b4ce4f1fba1c3e305aa093 /lisp/eshell/esh-var.el
parent7c41016fca5ab0638f1e2fed260e2ee41f3400c2 (diff)
downloademacs-cee1cbfd54375cdece23d4741ced6b0c7091f6d9.tar.gz
Improve handling of $PATH in Eshell for remote directories
* lisp/eshell/esh-util.el (eshell-path-env, eshell-parse-colon-path): Make obsolete. (eshell-path-env-list): New variable. (eshell-connection-default-profile): New connection-local profile. (eshell-get-path): Reimplement using 'eshell-path-env-list'; add LITERAL-P argument. (eshell-set-path): New function. * lisp/eshell/esh-var.el (eshell-variable-aliases-list): Add entry for $PATH. (eshell-var-initialize): Add 'eshell-path-env-list' to 'eshell-subcommand-bindings'. * lisp/eshell/esh-ext.el (eshell-search-path): Use 'file-name-concat' instead of 'concat'. (eshell/addpath): Use 'eshell-get-path' and 'eshell-set-path'. * lisp/net/tramp-integration.el: Only apply Eshell hooks when 'eshell-path-env-list' is unbound. * test/lisp/eshell/esh-var-tests.el (esh-var-test/path-var/local-directory) (esh-var-test/path-var/remote-directory, esh-var-test/path-var/set) (esh-var-test/path-var/set-locally) (esh-var-test/path-var-preserve-across-hosts): New tests. * test/lisp/eshell/esh-ext-tests.el: New file. * test/lisp/eshell/eshell-tests-helpers.el (with-temp-eshell): Set 'eshell-last-dir-ring-file-name' to nil. (eshell-tests-remote-accessible-p, eshell-last-input) (eshell-last-output): New functions. (eshell-match-output, eshell-match-output--explainer): Use 'eshell-last-input' and 'eshell-last-output'. * doc/misc/eshell.texi (Variables): Document $PATH. * etc/NEWS: Announce this change (bug#57556).
Diffstat (limited to 'lisp/eshell/esh-var.el')
-rw-r--r--lisp/eshell/esh-var.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index caf143e1a1a..57ea42f4933 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -156,7 +156,14 @@ if they are quoted with a backslash."
("LINES" ,(lambda () (window-body-height nil 'remap)) t t)
("INSIDE_EMACS" eshell-inside-emacs t)
- ;; for eshell-cmd.el
+ ;; for esh-ext.el
+ ("PATH" (,(lambda () (string-join (eshell-get-path t) (path-separator)))
+ . ,(lambda (_ value)
+ (eshell-set-path value)
+ value))
+ t t)
+
+ ;; for esh-cmd.el
("_" ,(lambda (indices quoted)
(if (not indices)
(car (last eshell-last-arguments))
@@ -249,7 +256,8 @@ copied (a.k.a. \"exported\") to the environment of created subprocesses."
(setq-local eshell-subcommand-bindings
(append
'((process-environment (eshell-copy-environment))
- (eshell-variable-aliases-list eshell-variable-aliases-list))
+ (eshell-variable-aliases-list eshell-variable-aliases-list)
+ (eshell-path-env-list eshell-path-env-list))
eshell-subcommand-bindings))
(setq-local eshell-special-chars-inside-quoting