help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is it possible to pass shell variables to emacs?


From: Joel J. Adamson
Subject: Re: is it possible to pass shell variables to emacs?
Date: Fri, 07 Dec 2007 12:59:39 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

"stuart.tett@gmail.com" <stuart.tett@gmail.com> writes:

> On Dec 6, 2:35 pm, David Kastrup <d...@gnu.org> wrote:
>> "stuart.t...@gmail.com" <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

You access them as part of the return value from command-line-args or
command-line-args-left, as you would access the members of any other
list, e.g. car cdr nth nthcdr...

Each element is a string.

Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109


reply via email to

[Prev in Thread] Current Thread [Next in Thread]