[Top][All Lists]

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

Re: C-code : printing into a buffer

From: Stephen J. Turnbull
Subject: Re: C-code : printing into a buffer
Date: Mon, 01 Jun 2009 10:57:00 +0900

A. Soare writes:

 > IStreams, as far as I see, create a pipe, such that the lisp
 > functions inside are redirected to a new-created stream. But the
 > lisp functions print messages via a lisp function like (message),
 > and this function know the pipe where to print.

That's "L for Lisp" lstreams, and it works both ways.  You can also
attach an lstream to a file descriptor and take input from it.  It
sounds to me like that's exactly what you want, because an
fd-to-buffer lstream will handle all the mechanics of updating the
buffer gap, converting external encoding to Mule internal, and so on.
You just need to set up the pipeline and specify the coding system.

I'm sure it's also possible in Emacs with sufficient mucking about.
However in XEmacs (and derivatives such as XEmacs/CHISE and SXEmacs)
it's a standard (though internal) feature.

 > The Istreams concept is also explained in SICP. Nothing unusual.

*shrug*  It's *your* problem, and if you're not willing to study
available methods more carefully than that, you've going to do a lot
of redundant work.  Of course, if your goal is to contribute them to
Emacs, reinventing them is not redundant because XEmacs's lstreams
aren't paper-trained, so Emacs can't port them.

OTOH, if you're mostly interested in achieving a solution with a
minimal amount of work, you can grit your teeth and use S?XEmacs, and
have it today.  In fact, if you use SXEmacs, you may be able to do it
all from Lisp using their standard FFI interface.

 > > A. Soare writes:
 > > 
 > >  > > > My problem is to define a buffer in emacs such that in the
 > >  > > > moment when I call this function via a pointer, all its output
 > >  > > > to be discarged in that buffer, not in the terminal of emacs.
 > > 
 > > In XEmacs you could do this fairly straightforwardly with an lstream,
 > > I think (an lstream is the internal XEmacs primitive used to deal with
 > > anything that can be thought of as a sequence of bytes or characters).
 > > 
 > > I don't think Emacs has a corresponding facility.  If not, and you
 > > really need this badly, feel free to ask at address@hidden

reply via email to

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