std-var-restore | ![]() |
(std-var-restore) ; full version
(std-%var-simple-restore) ; acad independent
Error handler and environment restauration. To be called at the end of a user function. To be used only pairwise with STD-VAR-INIT
Restores all old settings as before the appropriate STD-VAR-INIT or STD-%VAR-SIMPLE-INIT call. It does some housekeeping and calls for every error stack frame STD-VAR-POP. For details see there.
It provides a "silent exit" as with (princ) or (prin1) so it is usually used as very last function in a user callable command (C:xxx)
Nesting:
STD-VAR-INIT and STD-VAR-RESTORE may not be nested, use the simplier STD-VAR-PUSH and STD-VAR-POP for nested error stack frames. If a nested init/restore pair is used, e.g. in calling "transparent" lisp functions inside another lisp function or by accident, a warning is printed ("Tried to restore wrong error handler. Fixed.
") and the caller continues with the global state - as before the first std-var-init call. Such transparent callable function should use the :TRANSPARENT flag or use std-var-push/std-var-pop instead.
STD-VAR-RESTORE is also called by *STD-ERROR*, STD-%VAR-SIMPLE-RESTORE is called by *STD-SIMPLE-ERROR*.
VL abort / pending stacks:
If you abort an evaluation in VL with the menu point "Abort Evaluation" be sure to call this function manually to close files, restore error handlers and such.
The next call of (std-var-init) will restore the pending state and prints a warning message "pending *STD:VAR-STACK* deleted. Previous function didn't end correctly." to remind you on this fact.
(defun c:usercommand ()
;; implicitly sets *std-error* and CMDECHO to 0,
;; also OSMODE and SNAPMODE to 0
(std-var-init '(("OSMODE" . 0) ("SNAPMODE" . 0))) ... (func) .. (std-var-restore) ) (defun func () (std-var-push '((:UCS))) ... (std-var-pop) )
None
None. Provides a "silent exit" as with (princ)
This function is only called because of it's side-effects. It sets and safe various system settings, dependent on the argument alist. See the description above.
It clears all active error stack frame in *STD:VAR-STACK*.
(std-require 'STDERROR)
Defined in STDERROR