[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How can I do output redirection to suppress output to the Listener?
- To: info-mcl@ministry.cambridge.apple.com
- Subject: How can I do output redirection to suppress output to the Listener?
- From: alexandr@world.std.com (SSA)
- Date: Thu, 10 Mar 1994 05:11:01 GMT
- Keywords: output, redirection null device *standard-output*
- Newsgroups: comp.lang.lisp.mcl
- Organization: The World Public Access UNIX, Brookline, MA
I need to know how to temporarily redirect standard output,
perhaps by temporarily rebinding the special variable
*standard-output*, to suppress output to the Listener for
the following simple utility:
The utility would allow the user to enter built-in Lisp functions,
variables, macros and special forms by pulling down a menu
rather than typing. I have used the "Edit Menubar" command
in MCL's "Design" pulldown menu to insert a new, hierarchical
menu containing most of the commands defined in Steele's CLtL2.
The code below inserts the text '(defun )' in the current window at the
insertion point and then moves the insertion point backward
one character, so the user can continue typing before the close paren.
(progn (ed-insert-with-style *mouse-view* "(defun )" nil)
(move-mark (fred-buffer *mouse-view*) -1)
nil)
The problem is, this form evaluates to NIL, so I get an additional
"NIL" printed into the Listener window. I need to suppress this, or
redirect it to never-never land (which I think you do in Unix by
typing '> /dev/null', redirecting to the "null device").
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.
I'm sure there's a simple way to do this. Unfortunately, I can't
figure it out based on the descriptions given in CLtL.
Thanks for any help!
Scott Alexander
alexandr@world.std.com
The San Juan Star (newspaper)
San Juan, Puerto Rico
(809) 782-4200 x380