all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* accessing environment variable
@ 2007-09-10 13:57 Stephan Hennig
  2007-09-10 15:50 ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Stephan Hennig @ 2007-09-10 13:57 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

what is the preferred way to access an environment variable from within
the .emacs file?

I want to avoid writing hard coded paths into my .emacs file that had to
be adjusted after each update of, e.g., gs.  I've found the getenv
function should do what I want:

> getenv is an interactive compiled Lisp function in `env.el'.
> (getenv variable)
>
> Get the value of environment variable variable.
> variable should be a string.  Value is nil if variable is undefined in
> the environment.  Otherwise, value is a string.
>
> This function consults the variable `process-environment'
> for its value.

Since environment variable GS_PROG points to the GhostScript binary,
i.e., is of the pattern "path\to\gs\gswin32c.exe", I've tried various
combinations (quoting, escaping and parenthesizing) of

(getenv GS_PROG)

but I always get an error

> Printing...
> apply: Searching for program: no such file or directory, (getenv GS_PROG)

or similar in the *Message* buffer.  It seems to me getenv isn't
executed, but treated literally in this context.  How do I correctly
refer to an environment variable here?

Best regards,
Stephan Hennig


Windows XP,
This is GNU Emacs 22.1.50.1 (i386-mingw-nt5.1.2600) of 2007-07-07 on
NEUTRINO

From my .emacs:

;;
;; Emacs Customization
;;

(custom-set-variables
[...]
 '(ps-lpr-command "(getenv GS_PROG)")
[...]

^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <mailman.640.1189439467.18990.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2007-09-14  9:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-10 13:57 accessing environment variable Stephan Hennig
2007-09-10 15:50 ` Drew Adams
     [not found] <mailman.640.1189439467.18990.help-gnu-emacs@gnu.org>
2007-09-10 16:54 ` Stephan Hennig
2007-09-10 22:10   ` Harald Hanche-Olsen
2007-09-14  9:46     ` Stephan Hennig

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.