all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: jadamson@partners.org (Joel J. Adamson)
To: help-gnu-emacs@gnu.org
Subject: Re: is it possible to pass shell variables to emacs?
Date: Fri, 07 Dec 2007 12:59:39 -0500	[thread overview]
Message-ID: <87bq92s7w4.fsf@W0053328.mgh.harvard.edu> (raw)
In-Reply-To: 05d07222-2a31-4399-90eb-63a0230a386a@s12g2000prg.googlegroups.com

"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

  parent reply	other threads:[~2007-12-07 17:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2007-12-09  6:19     ` Tim X
2007-12-09  6:10 ` Tim X

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bq92s7w4.fsf@W0053328.mgh.harvard.edu \
    --to=jadamson@partners.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.