Re: [racket-users] Output Port Shenanigans
On 03/14/2018 06:16 PM, Lehi Toskin wrote: On Wednesday, March 14, 2018 at 10:10:20 AM UTC-7, Matthew Butterick wrote: probably it requires a combination of peek + read, or copying the port. That may be true, but I've been messing around getting *anything* to print from inside that function. I'm beginning to think it's never actually being run, which leads me to believe this may be a bug. According to the docs, special-filter is only applied to values written using `write-special`. So it is never run on ordinary text. `write-special` is part of the machinery that lets you, for example, `display` a pict in DrRacket and have an image show up in the interactions window. Most ports do not support specials; it doesn't make sense for ports that connect to the outside world (file ports, TCP ports, etc). Your original solution using `make-output-port` was probably the right one. Ryan -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Output Port Shenanigans
On Wednesday, March 14, 2018 at 10:10:20 AM UTC-7, Matthew Butterick wrote: > > > probably it requires a combination of peek + read, or copying the port. > > That may be true, but I've been messing around getting *anything* to print from inside that function. I'm beginning to think it's never actually being run, which leads me to believe this may be a bug. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Output Port Shenanigans
> On Mar 13, 2018, at 8:50 AM, Lehi Toskin wrote: > > There must be something I'm missing, but there's not much in the docs that > would help me. Just a guess, but this kind of double-dipping on ports is usually not possible, because once bytes are read from a port, they're gone. If you want to display the bytes twice, probably it requires a combination of peek + read, or copying the port. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Output Port Shenanigans
Hello, everyone! I'm trying to get an output port to display text to both the error port and a text% object every time there's an error or an `eprintf` is called. Now, I have already accomplished this by using `make-output-port`, but I had decided to try and use `open-output-text-editor` instead just for gits and shiggles. In the procedure documentation it shows that it takes a lambda labeled "special filter", so I figured I'd hijack this lambda to then fprintf to the error port, but for whatever reason it seems that all printing that is done from inside that special filter's scope is sent I have tried the following, but without any success: (define old-out (current-output-port)) ; now inside special filter's scope (lambda (s) (fprintf old-out "foo") s) There must be something I'm missing, but there's not much in the docs that would help me. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.