Subject: bug#66636: Move lexical-binding warning from checkdoc to byte-compiler

From: Stefan Kangas <[email-masked]>
Date: Thu, 19 Oct 2023 10:40:31 -0700

Mattias Engdegård <[email-masked]> writes:

> The warning about a missing lexical-binding cookie rather belongs in
> the compiler than checkdoc, because it's not about documentation or
> style but code generation and ability to detect errors, both which are
> hindered by a missing cookie.
>
> Moving the warning to the compiler also makes it more widely seen.

Yes, that makes much more sense.  Thanks for doing that.

The patch looks good too.

> +    ;;; My little pony mode  -*- lexical-binding: t -*-

If we want this to conform with the format required by package.el, this
should be:

;;; pony.el --- My little pony mode  -*- lexical-binding: t -*-

Or would that distract from the main point?

> +Lexical binding avoids some name conflicts and allows the compiler
> +to detect more mistakes and generate more efficient code.

On a side note, it would be good to also highlight this in the relevant
sections of the manual.