[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

redirecting *standard-output* to a different buffer ?

Thibault Langlois

3/24/2016 12:34:00 PM

Hello,

Does someone know how to redirect *standard-output* to a different emacs buffer (not the repl buffer) ? (I am using slime+sbcl.)

I sometimes use slime repl as someone would use matlab repl i.e. it quickly becomes cluttered with the output of previous commands. I could modify those commands to prevent them to produce too much output but the fact is that I have to take a look at it. I just want to unclutter the repl.

Any ideas ?

Thanks

Thibault

2 Answers

Barry Margolin

3/24/2016 4:53:00 PM

0

In article <42bd462d-cc6e-4f31-bbf6-27ae3b9e8bb6@googlegroups.com>,
Thibault Langlois <thibault.langlois@gmail.com> wrote:

> Hello,
>
> Does someone know how to redirect *standard-output* to a different emacs
> buffer (not the repl buffer) ? (I am using slime+sbcl.)
>
> I sometimes use slime repl as someone would use matlab repl i.e. it quickly
> becomes cluttered with the output of previous commands. I could modify those
> commands to prevent them to produce too much output but the fact is that I
> have to take a look at it. I just want to unclutter the repl.
>
> Any ideas ?
>
> Thanks
>
> Thibault

Emacs-specific questions are better asked in Emacs newsgroups like
comp.emacs or gnu.emacs.help.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

Pascal J. Bourguignon

3/26/2016 10:34:00 PM

0

Thibault Langlois <thibault.langlois@gmail.com> writes:

> Hello,
>
> Does someone know how to redirect *standard-output* to a different emacs buffer (not the repl buffer) ? (I am using slime+sbcl.)
>
> I sometimes use slime repl as someone would use matlab repl i.e. it
> quickly becomes cluttered with the output of previous commands. I
> could modify those commands to prevent them to produce too much output
> but the fact is that I have to take a look at it. I just want to
> unclutter the repl.
>
> Any ideas ?

It's not easy.

Two solutions:

- You would have to patch slime. Then it wouldn't be a redirection of
*standard-output* per se, since it would stay the same, but you would
redirect where slime writes the output it collected. Notice that
slime already does it, eg. when you type C-u C-x C-e in a lisp buffer,
it prints the output in the current buffer.

- You could do it by using the swank/slime RPC, which allows you to call
from CL an emacs lisp function (evaluate an expression actually).
Then you can implement an output stream using Gray streams (not
standard, but semi-standard and available in most implementations),
and have this gray stream call emacs to insert the output in the
buffer you want. You would then bind *standard-output* to that Gray
stream.

You can see how it can be done from:
https://github.com/informatimago/nasium-lse/blob/master/src/swank-ter...
this doesn't redirect the stream, but uses the swank/slime RPC to add
handling of CR in the slime repl.


--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk