all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* shell command output question
@ 2002-04-23 20:30 Noel Yap
  2002-04-24  5:13 ` Kalyan K. Mukherjea
  2002-04-24 13:15 ` Niklas Morberg
  0 siblings, 2 replies; 9+ messages in thread
From: Noel Yap @ 2002-04-23 20:30 UTC (permalink / raw)


I would like to have the following in my .emacs:
  (setq load-path (cons STUFF load-path))

where STUFF is the output of a command line.  Does
anyone know how I would be able to do this?

Thanks,
Noel

__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: shell command output question
@ 2002-04-25 16:50 Bingham, Jay
  2002-04-26 15:58 ` G Anna
  0 siblings, 1 reply; 9+ messages in thread
From: Bingham, Jay @ 2002-04-25 16:50 UTC (permalink / raw)


The following will work as long as there is only one new line in the string and it is at the end of the string:

(setq load-path (cons (split-string (shell-command-to-string
	"your_command") "\n") load-path)))

From what you are trying to do I assume that "your command" will be something like "echo $PATH".  You can access environment variables with the command getenv

So you could accomplish the same with:

(setq load-path (cons (getenv "PATH") load-path)))


J_)
C_)ingham
.    COMPAQ NonStop Integrity Systems
.    Austin, TX
. Language is the apparel in which your thoughts parade in public.
. Never clothe them in vulgar and shoddy attire. -Dr. George W. Crane-

 -----Original Message-----
From: 	Noel Yap [mailto:yap_noel@yahoo.com] 
Sent:	Wednesday, 24 April, 2002 9:50 p
To:	Niklas Morberg
Cc:	help-gnu-emacs@gnu.org
Subject:	Re: shell command output question

--- Niklas Morberg <niklas.morberg@axis.com> wrote:
> Noel Yap <yap_noel@yahoo.com> writes:
> 
> > I would like to have the following in my .emacs:
> >   (setq load-path (cons STUFF load-path))
> >
> > where STUFF is the output of a command line.  Does
> > anyone know how I would be able to do this?
> 
> shell-command-to-string might be your friend. Does
> this work?
> 
> (setq load-path (cons (shell-command-to-string
> 		       "your_command") load-path))

It sort of does.  I just need to strip off the CR at
the end.  Would you happen to know how I can do that?

Thanks,
Noel


__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-04-27  6:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-23 20:30 shell command output question Noel Yap
2002-04-24  5:13 ` Kalyan K. Mukherjea
2002-04-24 11:09   ` Noel Yap
2002-04-24 13:15 ` Niklas Morberg
2002-04-25  2:50   ` Noel Yap
  -- strict thread matches above, loose matches on Subject: below --
2002-04-25 16:50 Bingham, Jay
2002-04-26 15:58 ` G Anna
2002-04-26 19:26   ` Noel Yap
2002-04-27  6:39     ` G Anna

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.