From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tak Ota Newsgroups: gmane.emacs.devel Subject: sourcing environment Date: Tue, 10 Oct 2006 15:09:56 -0700 (PDT) Organization: Sony Electronics Inc. Message-ID: <20061010.150956.91284903.Takaaki.Ota@am.sony.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1160518232 1272 80.91.229.2 (10 Oct 2006 22:10:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 Oct 2006 22:10:32 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 11 00:10:26 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GXPnr-0005k8-DR for ged-emacs-devel@m.gmane.org; Wed, 11 Oct 2006 00:10:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GXPnq-0002Wx-Sh for ged-emacs-devel@m.gmane.org; Tue, 10 Oct 2006 18:10:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GXPng-0002Wp-0q for emacs-devel@gnu.org; Tue, 10 Oct 2006 18:10:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GXPnd-0002WI-LH for emacs-devel@gnu.org; Tue, 10 Oct 2006 18:10:10 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GXPnd-0002WF-DQ for emacs-devel@gnu.org; Tue, 10 Oct 2006 18:10:09 -0400 Original-Received: from [63.161.60.49] (helo=outbound1-res-R.bigfish.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1GXPvV-0006IM-3f for emacs-devel@gnu.org; Tue, 10 Oct 2006 18:18:17 -0400 Original-Received: from outbound1-res.bigfish.com (localhost.localdomain [127.0.0.1]) by outbound1-res-R.bigfish.com (Postfix) with ESMTP id 1338F1053C0D for ; Tue, 10 Oct 2006 22:10:08 +0000 (UTC) Original-Received: from mail2-res-R.bigfish.com (unknown [172.18.16.1]) by outbound1-res.bigfish.com (Postfix) with ESMTP id 0C2AA1053C54 for ; Tue, 10 Oct 2006 22:10:08 +0000 (UTC) Original-Received: from mail2-res.bigfish.com (localhost.localdomain [127.0.0.1]) by mail2-res-R.bigfish.com (Postfix) with ESMTP id 01AD9798890 for ; Tue, 10 Oct 2006 22:10:08 +0000 (UTC) X-BigFish: V Original-Received: by mail2-res (MessageSwitch) id 1160518207913500_13331; Tue, 10 Oct 2006 22:10:07 +0000 (UCT) Original-Received: from mail8.fw-sd.sony.com (mail8.fw-sd.sony.com [160.33.66.75]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by mail2-res.bigfish.com (Postfix) with ESMTP id 2257E7987B6 for ; Tue, 10 Oct 2006 22:09:58 +0000 (UTC) Original-Received: from mail1.sgo.in.sel.sony.com (mail1.sgo.in.sel.sony.com [43.130.1.111]) by mail8.fw-sd.sony.com (8.12.11/8.12.11) with ESMTP id k9AM9vuj007371 for ; Tue, 10 Oct 2006 22:09:57 GMT Original-Received: from localhost (us00130290172a.am.sony.com [43.191.14.104]) by mail1.sgo.in.sel.sony.com (8.12.11/8.12.11) with ESMTP id k9AM9uRs015487 for ; Tue, 10 Oct 2006 22:09:56 GMT Original-To: emacs-devel@gnu.org X-Telephone: +1-858-942-3239 X-Fax------: +1-858-942-9142 X-SnailMail: 16450 West Bernardo Drive MZ7205, San Diego, CA 92127-1804 X-Mailer: Mew-5.1.50 on Emacs-22.0.50.1 (i386-mingw-nt5.1.2600 built on 2006-10-09) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:60593 Archived-At: 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.