unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74550: eshell cannot set the environment variable PATH on Windows
@ 2024-11-26 20:38 Siyuan Chen
  2024-11-26 21:14 ` Jim Porter
  0 siblings, 1 reply; 2+ messages in thread
From: Siyuan Chen @ 2024-11-26 20:38 UTC (permalink / raw)
  To: 74550

[-- Attachment #1: Type: text/plain, Size: 695 bytes --]

Reproduce steps:

1. Emacs -Q

2. M-x eval-expression `(setenv "PATH" (concat "C:/env" path-separator
(getenv "PATH")))`

3. M-x eshell

4. In the *eshell* window, type `echo $PATH`, but the path "C:/env" doesn't
show in the result.

P.S. I have also tried `eshell-set-path` and `with-environment-variables`,
but they cannot set PATH as well. For example,

(require 'eshell)

(defun eshell2()
  (interactive)
  (eshell-set-path '("C:/env"))
  (call-interactively 'eshell))

(defun eshell3()
  (interactive)
  (with-environment-variables (("PATH" (concat "C:/env" path-separator
(getenv "PATH"))))
    (call-interactively 'eshell)))

Emacs 29.4 on Windows 10.

Thanks.

Best regards,
Siyuan Chen

[-- Attachment #2: Type: text/html, Size: 1066 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#74550: eshell cannot set the environment variable PATH on Windows
  2024-11-26 20:38 bug#74550: eshell cannot set the environment variable PATH on Windows Siyuan Chen
@ 2024-11-26 21:14 ` Jim Porter
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Porter @ 2024-11-26 21:14 UTC (permalink / raw)
  To: Siyuan Chen, 74550

On 11/26/2024 12:38 PM, Siyuan Chen wrote:
> Reproduce steps:
> 
> 1. Emacs -Q
> 
> 2. M-x eval-expression `(setenv "PATH" (concat "C:/env" path-separator 
> (getenv "PATH")))`
> 
> 3. M-x eshell
> 
> 4. In the *eshell* window, type `echo $PATH`, but the path "C:/env" 
> doesn't show in the result.

Thanks for the bug report. This is an intentionally-incompatible change 
in Eshell to improve behavior with remote systems via Tramp. Here's the 
relevant section from the Emacs 29 NEWS:

> *** Eshell's PATH is now derived from 'exec-path'.
> For consistency with remote connections, Eshell now uses 'exec-path'
> to determine the execution path on the local or remote system, instead
> of using the PATH environment variable directly.

So instead, you want to do something like '(push "C:/env" exec-path)' in 
order to update the PATH in a way where Eshell sees it.






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-26 21:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-26 20:38 bug#74550: eshell cannot set the environment variable PATH on Windows Siyuan Chen
2024-11-26 21:14 ` Jim Porter

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).