[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Tue, 10 Oct 2006 15:09:56 -0700 (PDT)
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
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))
(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.
I don't subscribe to the mailing list so please reply explicitly.
- sourcing environment,
Tak Ota <=