GNU bug report logs - #59920
[PATCH] Make checkdoc warn if not using lexical-binding

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefankangas <at> gmail.com>

Date: Fri, 9 Dec 2022 10:11:01 UTC

Severity: wishlist

Tags: patch

Fixed in version 30.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59920 in the body.
You can then email your comments to 59920 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59920; Package emacs. (Fri, 09 Dec 2022 10:11:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefankangas <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 09 Dec 2022 10:11:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Make checkdoc warn if not using lexical-binding
Date: Fri, 9 Dec 2022 02:10:16 -0800
[Message part 1 (text/plain, inline)]
Severity: wishlist

The attached patch makes checkdoc warn if there's no lexical-binding
cookie.
[0001-Make-checkdoc-warn-if-not-using-lexical-binding.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59920; Package emacs. (Fri, 09 Dec 2022 12:26:01 GMT) Full text and rfc822 format available.

Message #8 received at 59920 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 59920 <at> debbugs.gnu.org
Subject: Re: bug#59920: [PATCH] Make checkdoc warn if not using lexical-binding
Date: Fri, 09 Dec 2022 14:25:04 +0200
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Fri, 9 Dec 2022 02:10:16 -0800
> 
> The attached patch makes checkdoc warn if there's no lexical-binding
> cookie.

Thanks, but I think this should be optional behavior.  checkdoc is not
only used by us.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59920; Package emacs. (Fri, 09 Dec 2022 12:43:01 GMT) Full text and rfc822 format available.

Message #11 received at 59920 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59920 <at> debbugs.gnu.org
Subject: Re: bug#59920: [PATCH] Make checkdoc warn if not using lexical-binding
Date: Fri, 9 Dec 2022 04:42:00 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, but I think this should be optional behavior.  checkdoc is not
> only used by us.

The idea here is to encourage others to upgrade to lexical-binding, as
we are already done (at least in emacs.git, if not yet in GNU ELPA).

I'm actually more concerned that this check will not reach enough users.
So while I think an option is a good idea, the best default is IMO to
have it enabled.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59920; Package emacs. (Fri, 09 Dec 2022 14:53:02 GMT) Full text and rfc822 format available.

Message #14 received at 59920 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 59920 <at> debbugs.gnu.org
Subject: Re: bug#59920: [PATCH] Make checkdoc warn if not using lexical-binding
Date: Fri, 09 Dec 2022 16:52:26 +0200
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Fri, 9 Dec 2022 04:42:00 -0800
> Cc: 59920 <at> debbugs.gnu.org
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Thanks, but I think this should be optional behavior.  checkdoc is not
> > only used by us.
> 
> The idea here is to encourage others to upgrade to lexical-binding, as
> we are already done (at least in emacs.git, if not yet in GNU ELPA).
> 
> I'm actually more concerned that this check will not reach enough users.
> So while I think an option is a good idea, the best default is IMO to
> have it enabled.

I said nothing about defaults.  I just think we should allow turning
off this warning.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59920; Package emacs. (Sat, 10 Dec 2022 23:27:02 GMT) Full text and rfc822 format available.

Message #17 received at 59920 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59920 <at> debbugs.gnu.org
Subject: Re: bug#59920: [PATCH] Make checkdoc warn if not using lexical-binding
Date: Sat, 10 Dec 2022 15:26:03 -0800
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

> I just think we should allow turning off this warning.

Agreed, thanks.  I've added that in the attached.
[0001-Make-checkdoc-warn-if-not-using-lexical-binding.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59920; Package emacs. (Sun, 11 Dec 2022 07:30:02 GMT) Full text and rfc822 format available.

Message #20 received at 59920 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 59920 <at> debbugs.gnu.org
Subject: Re: bug#59920: [PATCH] Make checkdoc warn if not using lexical-binding
Date: Sun, 11 Dec 2022 09:29:48 +0200
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Sat, 10 Dec 2022 15:26:03 -0800
> Cc: 59920 <at> debbugs.gnu.org
> 
> +(defcustom checkdoc-lexical-binding-flag t
> +  "Non-nil means generate warnings if file is not using lexical binding.
> +See Info node `(elisp) Converting to Lexical Binding' for more."
> +  :type 'boolean
> +  :version "29.1")

Should be "30.1", I guess?

> +                 (checkdoc-create-error
> +                  "The first line should end with \"-*- lexical-binding: t -*-\""

Is this accurate?  IOW, does the lexical-binding cookie have to be the
last on the first line?

Otherwise, LGTM, thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59920; Package emacs. (Mon, 12 Dec 2022 02:22:02 GMT) Full text and rfc822 format available.

Message #23 received at 59920 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59920 <at> debbugs.gnu.org
Subject: Re: bug#59920: [PATCH] Make checkdoc warn if not using lexical-binding
Date: Sun, 11 Dec 2022 18:21:26 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> +(defcustom checkdoc-lexical-binding-flag t
>> +  "Non-nil means generate warnings if file is not using lexical binding.
>> +See Info node `(elisp) Converting to Lexical Binding' for more."
>> +  :type 'boolean
>> +  :version "29.1")
>
> Should be "30.1", I guess?

Yes, well spotted.

>> +                 (checkdoc-create-error
>> +                  "The first line should end with \"-*- lexical-binding: t -*-\""
>
> Is this accurate?  IOW, does the lexical-binding cookie have to be the
> last on the first line?

You're right, it's not accurate.  I changed it to say:

    The first line should contain "-*- lexical-binding: t -*-"

> Otherwise, LGTM, thanks.

Thanks.




Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Fri, 01 Sep 2023 20:09:02 GMT) Full text and rfc822 format available.

Notification sent to Stefan Kangas <stefankangas <at> gmail.com>:
bug acknowledged by developer. (Fri, 01 Sep 2023 20:09:02 GMT) Full text and rfc822 format available.

Message #28 received at 59920-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59920-done <at> debbugs.gnu.org
Subject: Re: bug#59920: [PATCH] Make checkdoc warn if not using lexical-binding
Date: Fri, 1 Sep 2023 22:07:50 +0200
Version: 30.1

Stefan Kangas <stefankangas <at> gmail.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> >> +(defcustom checkdoc-lexical-binding-flag t
> >> +  "Non-nil means generate warnings if file is not using lexical binding.
> >> +See Info node `(elisp) Converting to Lexical Binding' for more."
> >> +  :type 'boolean
> >> +  :version "29.1")
> >
> > Should be "30.1", I guess?
>
> Yes, well spotted.
>
> >> +                 (checkdoc-create-error
> >> +                  "The first line should end with \"-*- lexical-binding: t -*-\""
> >
> > Is this accurate?  IOW, does the lexical-binding cookie have to be the
> > last on the first line?
>
> You're right, it's not accurate.  I changed it to say:
>
>     The first line should contain "-*- lexical-binding: t -*-"
>
> > Otherwise, LGTM, thanks.
>
> Thanks.

Pushed to master as commit 7d60d1652fc.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 30 Sep 2023 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 207 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.