> From: Stephen Leake <stephen_le...@stephe-leake.org> > Cc: Nikolay Kudryavtsev <nikolay.kudryavt...@gmail.com>, > help-emacs-windows@gnu.org > Date: Tue, 04 Mar 2014 18:12:14 -0600 > > Eli Zaretskii <e...@gnu.org> writes: > > > In general, there's no way I know of to change PATH inside a running > > program (in this case Emacs), except by restarting it. > > You don't need to change the PATH of the Emacs process. You need to > change the PATH that emacs passes to processes it spawns. That's what > `exec-path' is for: > > > (setq exec-path > (list > (expand-file-name "~/bin") > (concat "/Apps/GNAT-" (getenv "GNAT_VERSION") "/bin") > (concat (getenv "ANDROID_HOME") "/tools") > (concat (getenv "ANDROID_HOME") "/platform-tools") > "c:/Program Files (x86)/Java/jdk1.7.0_05/bin" > (concat (getenv "ANT_HOME") "/bin") > (or > (getenv "EMACS_BIN") ;; emacs 23.2 > (getenv "EMACSPATH") ;; ? > (concat (getenv "emacs_dir") "/bin") ;; emacs 24.3 > ) > "c:/Projects/monotone/monotone-build_mingw" ; working version > ; "c:/MinGW/bin" ; dlls for new mtn version > ; "c:/Apps/monotone-1.0" ; current version; dlls > "c:/Apps/monotone-1.0.90" ; testing version; newer dlls > "c:/Apps/Inno_Setup_5.4.3" > "c:/bin" > "c:/WINDOWS/system32")) > (setenv "PATH" (mapconcat 'identity exec-path path-separator))
Not recommended to the faint at heart: how do you know for certain that Emacs's own value of PATH (as opposed to exec-path and process-environment), which is now different from these two, is not used anywhere? In any case, note that you are pushing directories onto PATH with forward slashes. Some (rare) programs don't like that, so caveat emptor.