emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proposal for extending set-process-filter


From: David Kastrup
Subject: Re: Proposal for extending set-process-filter
Date: 27 Apr 2004 22:46:07 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Stefan Monnier <address@hidden> writes:

> >> > 3) a file name for output.
> >> Can be handled by (1) just fine.  What would you use it for (other than
> >> /dev/null which is rather special since append is the same as overwrite)?
> > Consistency with the BUFFER argument of start-process (which would be
> > pretty much the same as the FILTER function, with the exception that
> > it establishes a control buffer that is the default for process
> > output, that will list the process as one of its processes, and that
> > will kill the process if the buffer gets killed).  Also efficiency:
> > redirecting a file descriptor to a file does not require Emacs
> > processing power.  It also does not require conversion into multibyte
> > strings and back and so on.
> 
> AFAIK, you can't do such a redirection after the exec.  I.e. it has
> to be an argument of `start-process' rather than set-process-filter.

Ouch.  I am so stupid.  In that case, the whole folderol obviously
needs to be made some option right at start-process time.

I'll have to think more about this.

> > Not really.  An open in append mode will also append at the end if
> > the file gets extended by a different process.  That's pretty hard to
> > do with a filter function.  One could start the file descriptor list
> > with
> > :append t
> > or so, however.
> 
> I thought the `append' arg of write-region did it right.

Probably.  But it would be quite wasteful to use Emacs for that.  But
since I forgot in my stupidity that once the fork has happened, we
can't work on anything but the pipe, of course one can't avoid Emacs
reading on the pipe.

Again, the _intent_ of the proposal was to allow redirections and
stuff like in a shell, and also different filter functions on
different file descriptors.

Naturally, it fails.  The stuff needs to be specified before exec.

> But for the same reason as above I don't think this can be done in
> set-process-filter: it has to be done before the `exec'.

Yes.

I am glad that there is somebody with a brain on one end of our
connection.

So obviously, this would need to be changed into a proposal for
start-process.  The BUFFER argument might be replaced by a cons cell
where the CAR is the previous BUFFER argument (meaning the buffer that
the process will get associated with), and the CDR is the contraption
that I proposed for set-process-filter.  set-process-filter could
still work as described, but it obviously would only be allowed to
apply to file descriptors under Emacs control (namely, pointing to a
buffer or filter function), and not file descriptors closed or
redirected to a file.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

[Prev in Thread] Current Thread [Next in Thread]