From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: is it possible to pass shell variables to emacs? Date: Sun, 09 Dec 2007 17:19:29 +1100 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <8763z8s83y.fsf@lion.rapttech.com.au> References: <44a8858b-32d1-4b14-803f-4cded782b968@a39g2000pre.googlegroups.com> <85lk87o3i9.fsf@lola.goethe.zz> <05d07222-2a31-4399-90eb-63a0230a386a@s12g2000prg.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1197182562 20604 80.91.229.12 (9 Dec 2007 06:42:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Dec 2007 06:42:42 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 09 07:42:52 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J1FsJ-0004EY-IC for geh-help-gnu-emacs@m.gmane.org; Sun, 09 Dec 2007 07:42:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J1Fs2-0004fK-9g for geh-help-gnu-emacs@m.gmane.org; Sun, 09 Dec 2007 01:42:34 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!sn-xt-sjc-03!sn-xt-sjc-10!sn-xt-sjc-01!sn-xt-sjc-08!sn-post-sjc-02!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:8AhTt7ijmTu9y5pTbkQ9jiSXI2Q= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 47 Original-Xref: shelby.stanford.edu gnu.emacs.help:154525 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:49951 Archived-At: "stuart.tett@gmail.com" writes: > On Dec 6, 2:35 pm, David Kastrup wrote: >> "stuart.t...@gmail.com" writes: >> > is there any possible way to do this? I would like to avoid making >> > them environment variables. I have a command-line script that when >> > called, sets all of these variables. I would like to use these >> > variables for example when finding a file. >> >> > Maybe there's some custom code I could put in my .emacs file. or I >> > could write a wrapper around emacs. >> >> emacs -eval '(setq a (pop argv) b (pop argv))' "$a" "$b" >> >> If your Emacs version is not a more recent developer version, you need >> to write command-line-args-left instead of argv. This is to be >> preferred to >> >> emacs -eval "(setq a \"$a\" b \"$b\")" >> >> since this will break if $a or $b contain characters or character >> sequences that are interpreted specially in literal Lisp strings. >> >> -- >> David Kastrup, Kriemhildstr. 15, 44793 Bochum > > > Great thanks. Question: some of these variables that I am passing in > refer to directories and I want to use them in the C-x C-f interface. > How do I access them? I don't think they work with $myvar > Maybe if you can elaborate more on what you want as your outcome we can provide better solutions. It could be that existing packages will do what you want more easily and consistently and with added features. For example, emacs has support for setting default path lists to look for files, finding files based on information such as what is around point, relative to a dired buffer or as part of a fileset etc. Maybe a simple load hook could do what you want etc. Emacs is very feature rich and a lot of very useful features need to be configured/enabled to get them working because there is no obvious defaults or because they may cause confusion unless explicitly asked for etc. -- tcross (at) rapttech dot com dot au