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

Re: How can I do output redirection to suppress output to the Listener?

>Steele says that calling the function 'make-broadcast-stream'
>with no arguments will return this type of "bit sink", which
>discards all characters sent to it, so I also foolishly tried
>the following:
>   (let ((*standard-output* (make-broadcast-stream)))
>   (progn (ed-insert-with-style *mouse-view* "(defun )" nil)
>          (move-mark (fred-buffer *mouse-view*) -1)
>          nil))
>...which of course doesn't help, because I guess *standard-output*
>here is just another local variable, distinct from the globally defined
>*standard-output* that I really want to change.

You _are_ changing the globally defined *standard-output* since it is a
special variable, but only inside the scope of the let. The problem you are
having is that the entire form is evaluated in the "read-eval-print" loop,
so regardless of the value of *standard-output* inside the form, the value
returned by the form is NIL and this is what is printed by the
"read-eval-print" loop.

You probably want the form evaluated during MCL event processing. If you
perform the action above in a menu-item action method, then NIL will not be
printed. For example, nothing is printed when MCL opens a file using the
Open... menu item. I guess that you are now evaluating the form from the
listener or from a fred buffer using Enter, and thus using the
"read-eval-print" loop and not MCL event processing.