unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* open file and command substitution of bash
@ 2010-01-04 15:37 alin.s
  2010-01-04 15:48 ` Davis Herring
  0 siblings, 1 reply; 4+ messages in thread
From: alin.s @ 2010-01-04 15:37 UTC (permalink / raw)
  To: Emacs-devel


I try to start emacs reading a file from a fifo, and I cannot.

I tried to do so:

exec 5< <(ls)

In this case , <(ls) returns a file descriptor, and I duplicate it in file
descriptor 5.

Then I start emacs so:

emacs /dev/fd/5

The result: File exists, but cannot be read...

This happens because emacs cannot read pipe files...

However, I suppose that emacs uses pipes for implementing processes... It
cannot read its stdin from a pipe and create a buffer with?


Thanks for any clarification.




-- 
View this message in context: http://old.nabble.com/open-file-and-command-substitution-of-bash-tp27014612p27014612.html
Sent from the Emacs - Dev mailing list archive at Nabble.com.





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

* Re: open file and command substitution of bash
  2010-01-04 15:37 open file and command substitution of bash alin.s
@ 2010-01-04 15:48 ` Davis Herring
  2010-01-05  9:13   ` alin.s
  0 siblings, 1 reply; 4+ messages in thread
From: Davis Herring @ 2010-01-04 15:48 UTC (permalink / raw)
  To: alin.s; +Cc: emacs-devel

> emacs /dev/fd/5

You could just do emacs <(ls) -- bash replaces <(ls) with something like
/dev/fd/63 anyway.

> However, I suppose that emacs uses pipes for implementing processes... It
> cannot read its stdin from a pipe and create a buffer with?

Certainly one could (in C) arrange for Emacs to open a file name and treat
it as if it were a pipe from a process.  But Emacs doesn't consider that
the same operation as visiting a file, which is what is requested when you
use file names as arguments.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




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

* Re: open file and command substitution of bash
  2010-01-04 15:48 ` Davis Herring
@ 2010-01-05  9:13   ` alin.s
  2010-01-05 17:08     ` Davis Herring
  0 siblings, 1 reply; 4+ messages in thread
From: alin.s @ 2010-01-05  9:13 UTC (permalink / raw)
  To: Emacs-devel



The easiest form that I find to open the output is

R=mktemp; tee < <(ls) >${R} && emacs $R




Davis Herring wrote:
> 
>> emacs /dev/fd/5
> 
> You could just do emacs <(ls) -- bash replaces <(ls) with something like
> /dev/fd/63 anyway.
> 
>> However, I suppose that emacs uses pipes for implementing processes... It
>> cannot read its stdin from a pipe and create a buffer with?
> 
> Certainly one could (in C) arrange for Emacs to open a file name and treat
> it as if it were a pipe from a process.  But Emacs doesn't consider that
> the same operation as visiting a file, which is what is requested when you
> use file names as arguments.
> 
> Davis
> 
> -- 
> This product is sold by volume, not by mass.  If it appears too dense or
> too sparse, it is because mass-energy conversion has occurred during
> shipping.
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/open-file-and-command-substitution-of-bash-tp27014612p27025578.html
Sent from the Emacs - Dev mailing list archive at Nabble.com.





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

* Re: open file and command substitution of bash
  2010-01-05  9:13   ` alin.s
@ 2010-01-05 17:08     ` Davis Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Davis Herring @ 2010-01-05 17:08 UTC (permalink / raw)
  To: alin.s; +Cc: emacs-devel

> R=mktemp; tee < <(ls) >${R} && emacs $R

Isn't that just a complicated way of saying

ls>$x && emacs $x

?  Even if your "<(ls)" is just a placeholder for some preexisting pipe
(maybe a FIFO or something), you could just do

cat <(ls) >$x && emacs $x

and lose the extra < before "<(ls)" too, since cat doesn't need it.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




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

end of thread, other threads:[~2010-01-05 17:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-04 15:37 open file and command substitution of bash alin.s
2010-01-04 15:48 ` Davis Herring
2010-01-05  9:13   ` alin.s
2010-01-05 17:08     ` Davis Herring

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).