Pushing and popping context
There are times when you may want to save ADEdit’s current context, change it to a new context to work on different objects in different domains, and then revert back to the original context. This is particularly true when writing Tcl scripts with subroutines, where you may want to feel free to complete a completely new context without altering the context of the calling code.
ADEdit offers a push
and a pop
command to save and retrieve contexts to a stack maintained in memory. push
saves the complete current context—all of its bindings and selected objects—to the stack. Subsequent push
commands save more contexts to the top of the stack, pushing the older contexts further down the stack, allowing for nested subroutines.
pop
reads the context from the top of the stack and restores it to memory as the current context. pop
also removes the restored context from the stack. Subsequent pop
commands pop more contexts off the stack until the stack is empty, at which point pop
returns an error.