Triple coffee... I don't use eshell much, so need to add that you may want to use "addpath" in an eshell instance which you can verify running eshell-get-path in eshell.

On Sun, Dec 8, 2024 at 3:14 PM Ship Mints <shipmints@gmail.com> wrote:
Sheesh, I need more coffee... More like this since it's an OS path:

  (concat "/tmp/foo/bar" path-separator (getenv "PATH"))

On Sun, Dec 8, 2024 at 2:51 PM Ship Mints <shipmints@gmail.com> wrote:
Couple of things. First, you should not be concatenating paths like you showed. Do the following instead and it will be cross platform and more "correct":

  (file-name-concat "/tmp/foo/bar" (getenv "PATH"))

Second, a question. After you setenv your PATH, in eshell, what does "echo $PATH" show?

On Sun, Dec 8, 2024 at 1:51 PM the_wurfkreuz via Emacs development discussions. <emacs-devel@gnu.org> wrote:
Is it possible to set environment variables and access them immediately without reloading the Emacs configuration (like using the load-file function)?

For instance, when I evaluate this code to set the PATH variable:

(let ((paths '("/some/path"
              "/some/path/2")))
  ;; (setq exec-path (append paths exec-path))
  (setenv "PATH" (concat (string-join paths ":")
                        ":"
                        (getenv "PATH"))))

And then try to launch eshell in the current Emacs session, I find that the new values aren't appended. The only way to set them is to put the code into a config file and reload it through (load-file "~/.emacs.d/init.el").