all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* running emacs in perl script
@ 2004-02-08 12:52 Adam Hardy
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Hardy @ 2004-02-08 12:52 UTC (permalink / raw)


I've got a perl script which I use for ripping CDs. It gets the CDDB 
entry off the net, saves the entry in a file and then asks if I want to 
edit it with this command:

print `emacs \"/tmp/xmcd/$files[2]\"`;

This launches emacs with the file nicely in x-windows. However I often 
want to run the script on an old box which runs x so slowly I never 
bother and do everything on the command line.

But on the command line, this command above launches emacs in the 
background I think. I'm not sure. I never see emacs, the script just 
sits there with the cursor blinking, hanging below the command line.

If I do 'ps -eaf' I see an emacs process. But I can't get to it.

It makes no difference if I put the '-nw' flags on the emacs command.

Does anybody know what to do?

Adam
-- 
GNU Emacs 21.3.1 on Linux 2.4.20 Debian

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

* Re: running emacs in perl script
       [not found] <mailman.2085.1076244892.928.help-gnu-emacs@gnu.org>
@ 2004-02-08 16:34 ` Barry Margolin
  2004-02-08 21:14   ` Adam Hardy
  0 siblings, 1 reply; 3+ messages in thread
From: Barry Margolin @ 2004-02-08 16:34 UTC (permalink / raw)


In article <mailman.2085.1076244892.928.help-gnu-emacs@gnu.org>,
 Adam Hardy <emacs@cyberspaceroad.com> wrote:

> I've got a perl script which I use for ripping CDs. It gets the CDDB 
> entry off the net, saves the entry in a file and then asks if I want to 
> edit it with this command:
> 
> print `emacs \"/tmp/xmcd/$files[2]\"`;
> 
> This launches emacs with the file nicely in x-windows. However I often 
> want to run the script on an old box which runs x so slowly I never 
> bother and do everything on the command line.
> 
> But on the command line, this command above launches emacs in the 
> background I think. I'm not sure. I never see emacs, the script just 
> sits there with the cursor blinking, hanging below the command line.
> 
> If I do 'ps -eaf' I see an emacs process. But I can't get to it.
> 
> It makes no difference if I put the '-nw' flags on the emacs command.
> 
> Does anybody know what to do?

I think the problem is the backticks.  That causes emacs to be run with 
its stdout piped to the script.  I'm not sure why you're doing that -- 
do you really want to print all of the output that emacs generates?  
Something like this should be more appropriate:

system('emacs', "/tmp/xmcd/$files[2]");

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

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

* Re: running emacs in perl script
  2004-02-08 16:34 ` Barry Margolin
@ 2004-02-08 21:14   ` Adam Hardy
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Hardy @ 2004-02-08 21:14 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 02/08/2004 05:34 PM Barry Margolin wrote:
>>I've got a perl script which I use for ripping CDs. It gets the CDDB 
>>entry off the net, saves the entry in a file and then asks if I want to 
>>edit it with this command:
>>
>>print `emacs \"/tmp/xmcd/$files[2]\"`;
>>
>>This launches emacs with the file nicely in x-windows. However I often 
>>want to run the script on an old box which runs x so slowly I never 
>>bother and do everything on the command line.
>>
>>But on the command line, this command above launches emacs in the 
>>background I think. I'm not sure. I never see emacs, the script just 
>>sits there with the cursor blinking, hanging below the command line.
>>
>>If I do 'ps -eaf' I see an emacs process. But I can't get to it.
> 
> I think the problem is the backticks.  That causes emacs to be run with 
> its stdout piped to the script.  I'm not sure why you're doing that -- 
> do you really want to print all of the output that emacs generates?  
> Something like this should be more appropriate:
> 
> system('emacs', "/tmp/xmcd/$files[2]");
> 

Barry,
you're right. It works fine now on the command line or in x, with that 
adjustment.

I'm a total non-perl programmer. The use of 'print' as opposed to 
system() was completely arbitrary. Thanks alot.

Adam
-- 
GNU Emacs 21.3.1 on Linux 2.4.20 Debian

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

end of thread, other threads:[~2004-02-08 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-08 12:52 running emacs in perl script Adam Hardy
     [not found] <mailman.2085.1076244892.928.help-gnu-emacs@gnu.org>
2004-02-08 16:34 ` Barry Margolin
2004-02-08 21:14   ` Adam Hardy

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.