On Sun, Jun 7, 2009 at 3:11 AM, Lennart Borgman wrote: > Rethinking. Everything is wrong in my solution and suggestion. Coming back. Ok, here is what I believe is a reasonable solution. The first problem is that the semantics of let, make-variable-buffer-local etc are not clearly defined. I suggest the following semantics (instead of the one I proposed before): - When (let ...) shadows a variable it is exactly this variable (ie default or buffer local version) that should be revived after (let ...). - No buffer local variables should be deleted or created by the reviving of the shadowed variables after the (let ...) clause. - More exactly: if the variable is buffer local in the current buffer before (let ..) it is the buffer local variable in that buffer that should be revived. If it does not exist after (let..) nothing should be done. - And if a shadowed variable have been made buffer local during the let binding then it is still the default value that should be revived. The buffer local value should in this case not be changed after the (let ..) clause. I think with this semantics everything will be nearly as fast as before and there will be no such surprises as shown in this bug. What do others think? I have made a patch for this with some comments and questions. I have included this in my patched version of Emacs+EmacsW32 and have been using it myself for a couple of days without any problems. However please review this carefully and especially what I have called /* Case 1 in specbind */ in unbind_to.