Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!harpo!seismo!hao!hplabs!sri-unix!thomas%UTAH-GR@utah-cs From: thomas%UTAH-GR@utah-cs@sri-unix.UUCP Newsgroups: net.emacs Subject: Emacs #264: error in progn doesn't unbind variables : Fix Message-ID: <4467@sri-arpa.UUCP> Date: Tue, 23-Aug-83 06:04:00 EDT Article-I.D.: sri-arpa.4467 Posted: Tue Aug 23 06:04:00 1983 Date-Received: Wed, 24-Aug-83 12:38:49 EDT Lines: 54 From: Spencer W. Thomas 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; }