Hi, I'm trying to build a global error checking routine such that, if a custom lisp command is escaped mid-way through, the user's settings are returned to their previous state (i.e. before the command was issued). I found just such a routine at http://www.afralisp.net/lispa/lisp6.htm and have attempted to adapt it for my purposes but something's not right. For instance osnaps are not restored to their original setting. Below, I've included the handful of statements that top and tail my own custom lisp routine, together with the error checking routine (slightly modified from the original). Any thoughts: -- (defun c:gea () (initerr) ;error checking (command "_.undo" "_g")... ....(command "_.undo" "_end") (reset) (princ) ) -- ;;;error trapping, based on a script provided by K. Ramage at ;;;http://www.afralisp.net/lispa/lisp6.htm (defun error() ;load function (prompt "\nGlobal Error Trap Loaded") ;inform user (princ) );defun ;;;*========================================================== (defun initerr () ;init error (setq oldlayer (getvar "clayer")) ;save settings (setq oldblipmode (getvar "blipmode")) (setq oldmenuecho (getvar "menuecho")) (setq oldhighlight (getvar "highlight")) (setq oldcmdecho (getvar "cmdecho")) (setq oldlunits (getvar "lunits")) (setq oldsnap (getvar "osmode")) (setq oldpick (getvar "pickbox")) (setq temperr *error*) ;save *error* (setq *error* trap) ;reassign *error* (princ) );defun ;;;*=========================================================== (defun trap (errmsg) ;define trap (command nil nil nil) (if (not (member errmsg '("console break" "Function Cancelled")) ) (princ (strcat "\nError: " errmsg)) ;print message ) (command "undo" "b") ;undo back (setvar "clayer" oldlayer) ;reset settings (setvar "blipmode" oldblipmode) (setvar "menuecho" oldmenuecho) (setvar "highlight" oldhighlight) (setvar "cmdecho" oldcmdecho) (setvar "lunits" oldlunits) (setvar "osmode" oldsnap) (setvar "pickbox" oldpick) (princ "\nError Resetting Enviroment ") ;inform user (terpri) (setq *error* temperr) ;restore *error* (princ) );defun ;;;*=========================================================== (defun reset () ;define reset (setq *error* temperr) ;restore *error* (setvar "clayer" oldlayer) ;reset settings (setvar "blipmode" oldblipmode) (setvar "menuecho" oldmenuecho) (setvar "highlight" oldhighlight) (setvar "cmdecho" oldcmdecho) (setvar "lunits" oldlunits) (setvar "osmode" oldsnap) (setvar "pickbox" oldpick) (princ) );defun ;;;*====================================================== (princ)