* is it possible to pass shell variables to emacs?
@ 2007-12-06 19:38 stuart.tett
2007-12-06 22:35 ` David Kastrup
2007-12-09 6:10 ` Tim X
0 siblings, 2 replies; 7+ messages in thread
From: stuart.tett @ 2007-12-06 19:38 UTC (permalink / raw)
To: help-gnu-emacs
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.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: is it possible to pass shell variables to emacs?
2007-12-06 19:38 is it possible to pass shell variables to emacs? stuart.tett
@ 2007-12-06 22:35 ` David Kastrup
2007-12-07 17:13 ` stuart.tett
2007-12-09 6:10 ` Tim X
1 sibling, 1 reply; 7+ messages in thread
From: David Kastrup @ 2007-12-06 22:35 UTC (permalink / raw)
To: help-gnu-emacs
"stuart.tett@gmail.com" <stuart.tett@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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: is it possible to pass shell variables to emacs?
2007-12-06 22:35 ` David Kastrup
@ 2007-12-07 17:13 ` stuart.tett
2007-12-07 17:18 ` David Kastrup
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: stuart.tett @ 2007-12-07 17:13 UTC (permalink / raw)
To: help-gnu-emacs
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
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: is it possible to pass shell variables to emacs?
2007-12-07 17:13 ` stuart.tett
@ 2007-12-07 17:18 ` David Kastrup
2007-12-07 17:59 ` Joel J. Adamson
2007-12-09 6:19 ` Tim X
2 siblings, 0 replies; 7+ messages in thread
From: David Kastrup @ 2007-12-07 17:18 UTC (permalink / raw)
To: help-gnu-emacs
"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.
>
> 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
Huh? Emacs never gets to see the names of the shell variables. It just
gets to see their values.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: is it possible to pass shell variables to emacs?
2007-12-07 17:13 ` stuart.tett
2007-12-07 17:18 ` David Kastrup
@ 2007-12-07 17:59 ` Joel J. Adamson
2007-12-09 6:19 ` Tim X
2 siblings, 0 replies; 7+ messages in thread
From: Joel J. Adamson @ 2007-12-07 17:59 UTC (permalink / raw)
To: help-gnu-emacs
"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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: is it possible to pass shell variables to emacs?
2007-12-07 17:13 ` stuart.tett
2007-12-07 17:18 ` David Kastrup
2007-12-07 17:59 ` Joel J. Adamson
@ 2007-12-09 6:19 ` Tim X
2 siblings, 0 replies; 7+ messages in thread
From: Tim X @ 2007-12-09 6:19 UTC (permalink / raw)
To: help-gnu-emacs
"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
>
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: is it possible to pass shell variables to emacs?
2007-12-06 19:38 is it possible to pass shell variables to emacs? stuart.tett
2007-12-06 22:35 ` David Kastrup
@ 2007-12-09 6:10 ` Tim X
1 sibling, 0 replies; 7+ messages in thread
From: Tim X @ 2007-12-09 6:10 UTC (permalink / raw)
To: help-gnu-emacs
"stuart.tett@gmail.com" <stuart.tett@gmail.com> writes:
> Subject: is it possible to pass shell variables to emacs?
>
> 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.
Yep, either way would work.
,----[ C-h f setenv RET ]
| setenv is an interactive compiled Lisp function in `env.el'.
| (setenv VARIABLE &optional VALUE SUBSTITUTE-ENV-VARS)
|
| Set the value of the environment variable named VARIABLE to VALUE.
| VARIABLE should be a string. VALUE is optional; if not provided or
| nil, the environment variable VARIABLE will be removed.
|
| Interactively, a prefix argument means to unset the variable.
| Interactively, the current value (if any) of the variable
| appears at the front of the history list when you type in the new value.
| Interactively, always replace environment variables in the new value.
|
| SUBSTITUTE-ENV-VARS, if non-nil, means to substitute environment
| variables in VALUE with `substitute-env-vars', which see.
| This is normally used only for interactive calls.
|
| The return value is the new value of VARIABLE, or nil if
| it was removed from the environment.
|
| This function works by modifying `process-environment'.
|
| As a special case, setting variable `TZ' calls `set-time-zone-rule' as
| a side-effect.
|
| [back]
`----
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-12-09 6:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-06 19:38 is it possible to pass shell variables to emacs? stuart.tett
2007-12-06 22:35 ` David Kastrup
2007-12-07 17:13 ` stuart.tett
2007-12-07 17:18 ` David Kastrup
2007-12-07 17:59 ` Joel J. Adamson
2007-12-09 6:19 ` Tim X
2007-12-09 6:10 ` Tim X
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).