Gerd,

Ok.

I hope this bugreport is clearer -

Here's some code.

The variable ii is clearly set every time mac was defined OR called.

backquote should expand, and mac should have read its content as (list 'message "%S" ii).




(progn
  (setq lexical-binding nil)

  (dotimes (ii 10)
    (defmacro mac ()
      `(message "%S" ,ii)
      )
    (let
        ((old_ii ii))
      (setq ii 33)
      (mac)
      (setq ii old_ii)
      )))


You eval this code once. It works.
You eval this again. It works.
The third time, though, it lands you in the debugger. The very same code. Why the third time? And, why the debugger?  ii is well set every time it is used.

That was bug (b). That's clearly an emacs bug?


Here's (c) -

The third time, change every "ii" to "var" ,and change every "old_ii" to "old_var".
And, evaluate it.
We still get the very same error, but the error involves ii, not var. The code we are defining and eval'ing has no "ii" whatsoever. It should have forgotten the old mac that involved ii. We defined a new mac involving "var."