In article , Peter Dyballa wrote: > Am 17.05.2013 um 23:07 schrieb Doug Lewan: > > > I see a problem when M-x find-file is expanding ${VARIABLE} but not taking > > it from the newly defined environment variable. Everything else picks it up > > (I presume just via fork/exec). > > > > I hope this script is clearer. > > > > In shell: > > $ echo ${VARIABLE} > > /a/very/long/path > > $ emacs & > > Inside emacs: > > C-x C-f ${VARIABLE}/to/work <== Finds > > "/a/very/long/path/to/work". > > (setenv "VARIABLE" "/shorter/path") > > => "/shorter/path" > > M-! echo ${VARIABLE} > > "/shorter/path" > > M-x shell > > In shell inside emacs: > > $ echo ${VARIABLE} > > "/shorter/path" > > Back in emacs: > > C-x C-f ${VARIABLE}/to/Grandmothers/house > > This finds the file "/a/very/long/path/to/Grandmothers/house", where I sort > > of expect it to find "/shorter/path/to/Grandmothers/house". > > No, this cannot work in GNU Emacs with a regular *shell* buffer ­ maybe it > works in VIM? > > GNU Emacs is a host (or a PC) that allows other programmes to run inside it. > Every variable the external (whatsoever: Korn, Bourne, C, Š) shell > interpreter is setting, is a private variable of and only inside this shell > interpreter. And since it's just a shell interpreter it has no access to the > variables of GNU Emacs. No shell function exists for this purpose. But if you do: M-: (setenv "VARIABLE" "/shorter/path") inside Emacs, you're setting an environment variable in the Emacs process, not just within a program that's hosted by Emacs. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***