M-: (setq foo 1) RET
M-: (let ((foo 2)) (error "foo")) RET
M-: foo ---> 2
After an error, the `let' form gets exited too, so the global variable
isn't rebound to its original value.
If that's really happening, it's a very serious bug in `let'.
_Huge_ amounts of code depends on let dealing with errors correctly...
However when I tried to reproduce it using your example above, I couldn't
Are you sure your final test evaluation of `foo" above isn't done while
the debugger's recursive edit (with backtrace) is still active? While
in that recursive edit, you're still actually "inside" the let context.