From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: setenv and find-file Date: Sat, 18 May 2013 07:36:00 -0400 Organization: A noiseless patient Spider Message-ID: References: <155DEC68569B714B86C2C7075F5EDA9828F794FC@DAKIYA1.pegasus.local> <8089B172-1D9F-4ACA-83B0-92FABA47BD5B@Web.DE> <155DEC68569B714B86C2C7075F5EDA9828F7A60D@DAKIYA1.pegasus.local> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1368893517 17414 80.91.229.3 (18 May 2013 16:11:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 May 2013 16:11:57 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 18 18:11:57 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Udjjh-00072v-GJ for geh-help-gnu-emacs@m.gmane.org; Sat, 18 May 2013 18:11:57 +0200 Original-Received: from localhost ([::1]:37768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Udjjg-0004L1-V6 for geh-help-gnu-emacs@m.gmane.org; Sat, 18 May 2013 12:11:57 -0400 Original-Path: usenet.stanford.edu!goblin3!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!barmar.motzarella.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 51 Injection-Info: barmar.motzarella.org; posting-host="2be9e9f5dd9af768b8861af71b85fc28"; logging-data="16343"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JflYExI6WTt8Lee24tl7D" User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Cancel-Lock: sha1:LUrO2QavhfCJM/xM9N3O37mB69w= Original-Xref: usenet.stanford.edu gnu.emacs.help:198628 X-Mailman-Approved-At: Sat, 18 May 2013 12:11:36 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:90899 Archived-At: 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 ***