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-23 20:30 Noel Yap
@ 2002-04-24  5:13 ` Kalyan K. Mukherjea
  2002-04-24 11:09   ` Noel Yap
  2002-04-24 13:15 ` Niklas Morberg
  1 sibling, 1 reply; 9+ messages in thread
From: Kalyan K. Mukherjea @ 2002-04-24  5:13 UTC (permalink / raw)
  Cc: help-gnu-emacs

Hi Noel,
To output the result of a shell command into a buffer do;
\C-u \M-! command RETURN

Hope this helps.
Kalyan 

On Tue, 23 Apr 2002, Noel Yap wrote:

> 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/
> 
> _______________________________________________
> 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

* Re: shell command output question
  2002-04-24  5:13 ` Kalyan K. Mukherjea
@ 2002-04-24 11:09   ` Noel Yap
  0 siblings, 0 replies; 9+ messages in thread
From: Noel Yap @ 2002-04-24 11:09 UTC (permalink / raw)
  Cc: help-gnu-emacs

--- "Kalyan K. Mukherjea" <kalyan@isical.ac.in> wrote:
> Hi Noel,
> To output the result of a shell command into a
> buffer do;
> \C-u \M-! command RETURN

I apologize if my question wasn't clear enough.  I
would like to be able to use the output of a shell
command as input to a function in ~/.emacs.

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-23 20:30 Noel Yap
  2002-04-24  5:13 ` Kalyan K. Mukherjea
@ 2002-04-24 13:15 ` Niklas Morberg
  2002-04-25  2:50   ` Noel Yap
  1 sibling, 1 reply; 9+ messages in thread
From: Niklas Morberg @ 2002-04-24 13:15 UTC (permalink / raw)
  Cc: help-gnu-emacs

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))

Niklas

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

* Re: shell command output question
  2002-04-24 13:15 ` Niklas Morberg
@ 2002-04-25  2:50   ` Noel Yap
  0 siblings, 0 replies; 9+ messages in thread
From: Noel Yap @ 2002-04-25  2:50 UTC (permalink / raw)
  Cc: help-gnu-emacs

--- 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/

^ 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

* Re: shell command output question
  2002-04-25 16:50 shell command output question Bingham, Jay
@ 2002-04-26 15:58 ` G Anna
  2002-04-26 19:26   ` Noel Yap
  0 siblings, 1 reply; 9+ messages in thread
From: G Anna @ 2002-04-26 15:58 UTC (permalink / raw)



> Date: Thu, 25 Apr 2002 11:50:27 -0500
> From: "Bingham, Jay" <Jay.Bingham@compaq.com>
> Subj: RE: shell command output question

(snip)

> 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

That is exactly the kind of question one should ask.  What are you
trying to achieve? (This question is to the OP.)  Instead of asking
something related to what you want, just ask what you want.  You would
probably get a more elegant solution.

Cheers,
anna

-- 

Get your free e-mail account at http://www.linuxmail.org

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

* Re: shell command output question
  2002-04-26 15:58 ` G Anna
@ 2002-04-26 19:26   ` Noel Yap
  2002-04-27  6:39     ` G Anna
  0 siblings, 1 reply; 9+ messages in thread
From: Noel Yap @ 2002-04-26 19:26 UTC (permalink / raw)


--- G Anna <drguruolai@eth.net> wrote:
> 
> > Date: Thu, 25 Apr 2002 11:50:27 -0500
> > From: "Bingham, Jay" <Jay.Bingham@compaq.com>
> > Subj: RE: shell command output question
> 
> (snip)
> 
> > 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
> 
> That is exactly the kind of question one should ask.
>  What are you
> trying to achieve? (This question is to the OP.) 
> Instead of asking
> something related to what you want, just ask what
> you want.  You would
> probably get a more elegant solution.

OK.  Here it is.

I am running Cygwin on NT and I want to be able to use
the same .emacs on NT as on Unix.  Since emacs on NT
doesn't grok Cygwin paths, I need to convert the paths
passed into load-path into native paths.  So, I've
created a script on both Unix and NT that'll take a
path and convert it into a native path (on Unix, this
is just an echo; on NT it's just a cygpath -w). 
Ideally, I would have an emacs on NT that groks Cygwin
but I don't think that'll happen any time soon (last I
tried, emacs didn't build under Cygwin -- maybe it's
time to try again).

If anyone can suggest a better way to do this, I would
very much appreciate it.

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-26 19:26   ` Noel Yap
@ 2002-04-27  6:39     ` G Anna
  0 siblings, 0 replies; 9+ messages in thread
From: G Anna @ 2002-04-27  6:39 UTC (permalink / raw)
  Cc: help-gnu-emacs


> Date: Fri, 26 Apr 2002 12:26:36 -0700 (PDT)
> From: Noel Yap <yap_noel@yahoo.com>
> Subj: Re: shell command output question

(snip)

> I am running Cygwin on NT and I want to be able to use the same
> .emacs on NT as on Unix.  Since emacs on NT doesn't grok Cygwin
> paths, I need to convert the paths passed into load-path into native
> paths.  So, I've created a script on both Unix and NT that'll take a
> path and convert it into a native path (on Unix, this is just an
> echo; on NT it's just a cygpath -w).  Ideally, I would have an emacs
> on NT that groks Cygwin but I don't think that'll happen any time
> soon (last I tried, emacs didn't build under Cygwin -- maybe it's
> time to try again).

Well, for GNU Emacs on Windows the mailing list is
help-emacs-windows@gnu.org; My suggestion is to just repost this mail
to that mailing list.  

I use GNU Emacs on Linux, so I cannot help you much there.  Sorry, I
couldn't be of more help.

Cheers,
anna

-- 

(1) My Legions of Terror will have helmets with clear plexiglass
    visors, not face-concealing ones. - Peter Anspach in his 
    "The Top 100 Things I'd Do If I Ever Became An Evil Overlord"

^ 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-25 16:50 shell command output question Bingham, Jay
2002-04-26 15:58 ` G Anna
2002-04-26 19:26   ` Noel Yap
2002-04-27  6:39     ` G Anna
  -- strict thread matches above, loose matches on Subject: below --
2002-04-23 20:30 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

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.