Subject: Re: bug#54240: emacs/lisp/emacs-lisp/derived.el patch

From: Michael Heerdegen <[email-masked]>
Date: Fri, 04 Mar 2022 22:39:32 +0100

Lars Ingebrigtsen <[email-masked]> writes:

> Oh, yeah -- I was thinking that the mode had to be lexically bound
> there, but of course it isn't really, since eval is ... eval.  (Whenever
> there's an eval in code, there's a bug somewhere.)

`defvar' doesn't eval the first argument, and there is no alternative to
using it (right?).  So `derived-mode-init-mode-variables' should just
better be a macro I think.

> Would adding LEXICAL to the eval form fix the issue here, or would that
> interact oddly with the defvar?

Yes - since `defvar' doesn't evaluate its first argument no variable
references will work.  The constructed sexp must contain the final
symbol at that position, any other expression won't do it.

Michael.