I've changed my mind about the setvars function, though I'll leave existing posts as is.
I think error trapping the individual setvar calls is a bad idea. I started to think about that approach as applies to my "real world" programming and I could not think of a single instance where I would want to mask a setvar error, that is, prevent a program from crashing. The simple reason being (for me) that a failed setvar call represents a design flaw in my program (either the variable name is wrong or the candidate value is invalid) so I'd actually want it to trash the program (so I could code it proper). As a result I would alter the setvars function to act accordingly --
(defun setvars ( lst )
(mapcar
'(lambda ( var val ) (list var (getvar var) (setvar var val)))
(mapcar 'car lst)
(mapcar 'cadr lst)
)
)
Argument lst is (still) of the form '(("var" val)("var" val)), for example '(("cmdecho" 0)("regenmode" 1)).
The result is of the form form '(("var" oldval newval), for example '(("cmdecho" 1 0)("regenmode" 0 1)) so it can still be passed to the setvars function later, say at the end of program execution.
I realize this thread has become a ghost town <not sure how I killed it, tmi?> and I'm talking to myself but that's ok, point is still valid.