unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Single process output reading
@ 2004-08-16  9:21 Milan Zamazal
  2004-08-16 14:37 ` Kim F. Storm
  2004-08-18  1:34 ` Richard Stallman
  0 siblings, 2 replies; 10+ messages in thread
From: Milan Zamazal @ 2004-08-16  9:21 UTC (permalink / raw)


I think a way to read an output of just a single asynchronous process in
Emacs is needed.  I.e. a way to invoke accept-process-output without
possible invocation of another process filter function or a timer.

Why is it needed?  Currently, there's no way to do it AFAIK, which
basically means that all process filter functions must be reentrant.
Making a process filter function reentrant is not always a trivial task
and it's useless to do so except that the scenario like the following
one can happen:

A process filter function `foo' is invoked.  It reports about the
process reading progress via the `message' function.  `message' can be
advised, e.g. by some speech output function.  The speech output
function communicates with a speech synthesizer through a network
process and it calls accept-process-output to read the synthesizer's
answer.  But within the accept-process-output, `foo' can be invoked
again.  If it is not reentrant, errors can happen.

This is what actually happens in the speechd-el speech output system
which, among others, advises the `message' function.  So any filter
function calling `message' (or doing some other actions handled by the
speech output system) is fragile to this problem.

There's a workaround for this: To write an external program resending
the data/answer to/from the desired network connection and to call this
program synchronously from Emacs (anytime a piece of data is to be sent
to the network connection) with call-process.  This is what I actually
did, but I don't think it's a good way of solving the problem, both from
the point of view of the programmer and the user.

IMO a better way would be to allow restricting accept-process-output to
just a single process output reading.  Then the speech output system,
aware of possible consequences of advising 'message' etc., could invoke
accept-process-output in the restricted form, without the danger of
unwanted side effects.

I need this feature, so I'm willing to implement it unless someone more
competent would like to do it.

My questions are:

- Do you agree with my analysis or do you have a better suggestion how
  to solve the presented problem?

- Do you have some suggestions how the restricted invocation of
  accept-process-output might look?  New optional argument?

- Do you have some implementation advice?

Thanks for any help.

Regards,

Milan Zamazal

-- 
http://www.zamazal.org

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

end of thread, other threads:[~2004-08-20  4:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-16  9:21 Single process output reading Milan Zamazal
2004-08-16 14:37 ` Kim F. Storm
2004-08-17 11:31   ` Milan Zamazal
2004-08-17 11:38     ` Kim F. Storm
2004-08-17 20:42       ` Milan Zamazal
2004-08-18  1:34 ` Richard Stallman
2004-08-18 20:50   ` Milan Zamazal
2004-08-20  4:48     ` Richard Stallman
2004-08-19 11:40   ` Kim F. Storm
2004-08-20  4:49     ` Richard Stallman

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