[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changing Packages when SELECTing
Date: Thu, 6 Jul 89 10:22:08 mdt
How can I force a package change when I select a new activity?
I tried a quick hack of
(defmethod (select tv:select-mixin :after)()
(in-package <some package name>))
but that seems to have no effect as far as I can tell.
The correct way to do this is to establish a LET-binding (actually
SYS:STANDARD-VALUE-LET for interactive programs) for ZL:PACKAGE or
LISP:*PACKAGE* in that activity's top level. Then it is a simple matter to
change this binding, either with SETQ or
(SETF (SYS:STANDARD-VALUE *PACKAGE*
:LISTENER <listener-instance>) <new package>).
Most system-provided activities already have such a binding established.
You could also provide a special instance variable named ZL:PACKAGE or
LISP:*PACKAGE* in your window if you were so inclined. That is considered a
bit of a kludge, but it works. This binding would supersede any other binding
for that window's methods in any process, and would establish a binding in
that activity's process.
It's not surprising that your :AFTER method doesn't work. The SELECT generic
function generally does not run in the same process as the new activity; it
runs in the process that selects that activity, i.e. either the previous
window or the SELECT or FUNCTION key processes. Therefore, unless you have an
instance variable named ZL:PACKAGE or LISP:*PACKAGE* that has been declared
with :SPECIAL-INSTANCE-VARIABLES, your method would not affect the binding in
the selected activity.