thomas%UTAH-GR@utah-cs@sri-unix.UUCP (08/23/83)
From: Spencer W. Thomas <thomas%UTAH-GR@utah-cs>
Description:
In Emacs #264, if an error occurs within a progn, variables
which were rebound by the progn do not have their previous
values restored. The problem is that VnameArg returns
immediately if err is set, so the local variables are not
unbound.
Repeat-By:
(progn foo
(setq foo "foo")
(error-occurred (progn foo
(setq foo "bar")
(error-message "garbage")))
(message foo)
)
prints "bar". Or, even better
ESC-ESC (progn foo (setq foo "foo") (error-message "error"))
binds foo globally!
Fix:
In mlisp.c (ProgN()), change:
*** old
--- mlisp.c Tue Aug 23 03:45:07 1983
***************
*** 241,243
ProgN () {
! int rv = 0;
if (EI.FuncName == 0)
--- 241,243 -----
ProgN () {
! int rv = 0, saverr;
if (EI.FuncName == 0)
***************
*** 251,252
rv = ExecCode (EI.ArgN, EI.ArgMax);
for (i = 1; v = VnameArg (i); i++) {
--- 251,254 -----
rv = ExecCode (EI.ArgN, EI.ArgMax);
+ saverr = err;
+ err = 0;
for (i = 1; v = VnameArg (i); i++) {
***************
*** 259,260
}
}
--- 261,263 -----
}
+ err = saverr || err;
}