From: Tak Ota <Takaaki.Ota@am.sony.com>
Subject: sourcing environment
Date: Tue, 10 Oct 2006 15:09:56 -0700 (PDT) [thread overview]
Message-ID: <20061010.150956.91284903.Takaaki.Ota@am.sony.com> (raw)
Hello,
I use emacs at work for embedded software development. When switching
gears frequently between different cross compilation environment it is
common practice to set/change environment variables by sourcing shell
scripts.
Like many seasoned emacs users once I start emacs I don't want to
discontinue that process however to change environment I need to kill
the current emacs and source shell script to change environment and
restart emacs again. To alleviate this annoying inconvenience I now
use the following custom function to tweak the environment on the fly.
(defun source (script &optional shell)
"Source the specified shell script.
Source the shell SCRIPT and import the environment into this emacs.
The optional SHELL specifies the shell other than the default `shell-file-name'"
(interactive "fscript file: ")
(if (null shell)
(setq shell shell-file-name))
(with-temp-buffer
(call-process shell nil t nil "-c" (concat "source " script "; printenv"))
(while (re-search-backward "^\\([^=]+\\)=\\(.*\\)$" nil t)
(setenv (match-string 1) (match-string 2)))))
Has there been something equivalent to this already built into some
existing scripts? I bet many people have encountered this need.
Please educate my ignorance.
-Tak
P.S.
I don't subscribe to the mailing list so please reply explicitly.
next reply other threads:[~2006-10-10 22:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-10 22:09 Tak Ota [this message]
2006-10-11 8:35 ` sourcing environment Stephen Leake
2006-10-11 16:07 ` Tak Ota
2006-10-11 19:00 ` Giorgos Keramidas
2006-10-11 19:15 ` Tak Ota
2006-10-11 20:22 ` Giorgos Keramidas
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061010.150956.91284903.Takaaki.Ota@am.sony.com \
--to=takaaki.ota@am.sony.com \
/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 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).