Subject: bug#74550: eshell cannot set the environment variable PATH on Windows

From: Siyuan Chen <[email-masked]>
Date: Wed, 27 Nov 2024 04:38:30 +0800

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