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: Tim X
Subject: Re: is it possible to pass shell variables to emacs?
Date: Sun, 09 Dec 2007 17:19:29 +1100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

"address@hidden" <address@hidden> writes:

> On Dec 6, 2:35 pm, David Kastrup <address@hidden> wrote:
>> "address@hidden" <address@hidden> 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


reply via email to

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