From: Ship Mints <shipmints@gmail.com>
To: the_wurfkreuz <the_wurfkreuz@proton.me>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Creating and accessing environmental variables
Date: Sun, 8 Dec 2024 15:14:11 -0500 [thread overview]
Message-ID: <CAN+1HbpF1H7y9MMKMU4YEhuxp+-nuvURc+8NTspNqcqNirF2iQ@mail.gmail.com> (raw)
In-Reply-To: <CAN+1Hbpo6gcB8kNmPBO+n2reSNYks+2=J6r3OLdg8u0FKOAweQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1387 bytes --]
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").
>>
>
[-- Attachment #2: Type: text/html, Size: 3237 bytes --]
next prev parent reply other threads:[~2024-12-08 20:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-08 18:27 Creating and accessing environmental variables the_wurfkreuz via Emacs development discussions.
2024-12-08 19:51 ` Ship Mints
2024-12-08 20:14 ` Ship Mints [this message]
2024-12-08 20:23 ` Ship Mints
2024-12-08 20:33 ` the_wurfkreuz via Emacs development discussions.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAN+1HbpF1H7y9MMKMU4YEhuxp+-nuvURc+8NTspNqcqNirF2iQ@mail.gmail.com \
--to=shipmints@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=the_wurfkreuz@proton.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.