From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: C-code : printing into a buffer Date: Mon, 01 Jun 2009 10:57:00 +0900 Message-ID: <87y6scbtsj.fsf@uwakimon.sk.tsukuba.ac.jp> References: <21709273.2012831243588416702.JavaMail.www@wwinf4622> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1243821205 18677 80.91.229.12 (1 Jun 2009 01:53:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Jun 2009 01:53:25 +0000 (UTC) Cc: "Emacs Dev \[emacs-devel\]" To: alinsoar@voila.fr Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 01 03:53:22 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MAwiH-0001ZO-3O for ged-emacs-devel@m.gmane.org; Mon, 01 Jun 2009 03:53:21 +0200 Original-Received: from localhost ([127.0.0.1]:44569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MAwiG-0000Jq-LW for ged-emacs-devel@m.gmane.org; Sun, 31 May 2009 21:53:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MAwiA-0000GH-T3 for emacs-devel@gnu.org; Sun, 31 May 2009 21:53:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MAwi6-0000BJ-Bg for emacs-devel@gnu.org; Sun, 31 May 2009 21:53:14 -0400 Original-Received: from [199.232.76.173] (port=42849 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MAwi6-0000BG-7a for emacs-devel@gnu.org; Sun, 31 May 2009 21:53:10 -0400 Original-Received: from mtps02.sk.tsukuba.ac.jp ([130.158.97.224]:59030) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MAwi5-0005Am-Es for emacs-devel@gnu.org; Sun, 31 May 2009 21:53:10 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mtps02.sk.tsukuba.ac.jp (Postfix) with ESMTP id 3299A820E; Mon, 1 Jun 2009 10:52:59 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id DCCEE120C0B; Mon, 1 Jun 2009 10:57:00 +0900 (JST) In-Reply-To: <21709273.2012831243588416702.JavaMail.www@wwinf4622> X-Mailer: VM 8.0.12-devo-585 under 21.5 (beta28) "fuki" 83e35df20028+ XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:111228 Archived-At: 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 xemacs-beta@xemacs.org.