all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* sourcing environment
@ 2006-10-10 22:09 Tak Ota
  2006-10-11  8:35 ` Stephen Leake
  0 siblings, 1 reply; 6+ messages in thread
From: Tak Ota @ 2006-10-10 22:09 UTC (permalink / 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-10-11 20:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-10 22:09 sourcing environment Tak Ota
2006-10-11  8:35 ` 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

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.