Received: (at 67916) by debbugs.gnu.org; 20 Dec 2023 20:44:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 20 15:44:19 2023 Received: from localhost ([127.0.0.1]:41899 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rG3QR-0001iA-E6 for submit <at> debbugs.gnu.org; Wed, 20 Dec 2023 15:44:19 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:17993) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1rG3QP-0001hw-Ho for 67916 <at> debbugs.gnu.org; Wed, 20 Dec 2023 15:44:18 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4F471100068; Wed, 20 Dec 2023 15:44:08 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1703105047; bh=YQtgtOb/8JCvmVlAJ+ym5eRNnw3MFibDTBXh7u/w7B0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=MVa5UteRxbakR1LUEtVtgcyuzCF620D/A6aZhUSX3JA1zVJ/2Oru1b8ma1gBz8crt Lw6UXF4q2XOktGGgj1cc3G2XFCKpqmyCRDmvtgA2dhp0kfSXl+XaFoEO/AitK5VUK9 YH/q4LButtF7yr6MtUgPCbSlYUSZONeGNx3RF16Wd7PG8qWOUn91vdv8A9ztcVE1F8 pQzB7lUjJBD4zdegFkTWPO9e+N/dDxzlHpCkUXdltR5+v/DElpqeHQaH1m+8pGxygs XL+K5RUBlYWA2ZNrlHp28IYhbP48WvPnJEx8lHEDe2cIcc6qDB4cenLljpF00O7ggx 3VY2qg+2pCp1w== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 655E3100033; Wed, 20 Dec 2023 15:44:07 -0500 (EST) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 53F5E120774; Wed, 20 Dec 2023 15:44:07 -0500 (EST) From: Stefan Monnier <monnier@HIDDEN> To: "Basil L. Contovounesios" <contovob@HIDDEN> Subject: Re: bug#67916: 30.0.50; No lexical-binding directive warning in -pkg.el files In-Reply-To: <8734vwkaqi.fsf@HIDDEN> (Basil L. Contovounesios's message of "Wed, 20 Dec 2023 19:08:37 +0100") Message-ID: <jwv1qbgd2ws.fsf-monnier+emacs@HIDDEN> References: <87msu5q2vx.fsf@HIDDEN> <87y1dpon3v.fsf@HIDDEN> <87jzp8dhz8.fsf@HIDDEN> <8734vwkaqi.fsf@HIDDEN> Date: Wed, 20 Dec 2023 15:43:28 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.101 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67916 Cc: 67916 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>, Mattias =?windows-1252?Q?Engdeg=E5rd?= <mattias.engdegard@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > I'm wondering because elpa-admin.el seems to contain some compatibility > code for Emacs 26 (elpaa--select-revision, elpaa--write-pkg-file) and > Emacs versions <28 (elpaa--get-section, elpaa--html-build-doc). AFAIK `elpa-admin.el` is mostly used with "Emacs from Debian stable" (in `elpa.gnu.org`) and with the bleeding edge of Emacs, so backward compatibility is not very important beyond Emacs-28 now. The one you see is what was added at the time and simply hasn't been removed (yet). > You mean, you prefer package--unquote being a plain function? > [ To be honest, I'm slightly inclined to add this to macroexp.el > instead, since it's a somewhat common operation. ] Usually in the context of macro expansion you can use `eval` for that. Here we don't, for (arguably bogus) "security" reasons. Stefan
bug-gnu-emacs@HIDDEN
:bug#67916
; Package emacs
.
Full text available.Received: (at 67916) by debbugs.gnu.org; 20 Dec 2023 18:55:09 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 20 13:55:09 2023 Received: from localhost ([127.0.0.1]:41800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rG1ij-0005qh-Ea for submit <at> debbugs.gnu.org; Wed, 20 Dec 2023 13:55:08 -0500 Received: from mout01.posteo.de ([185.67.36.65]:35815) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <philipk@HIDDEN>) id 1rG1if-0005pp-3N for 67916 <at> debbugs.gnu.org; Wed, 20 Dec 2023 13:55:05 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 4E39A240027 for <67916 <at> debbugs.gnu.org>; Wed, 20 Dec 2023 19:54:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1703098491; bh=1RVk2ULYEryvNCIFv9jqfpFs2B5MPzXlKdr2ozZ00Rs=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=L/pEU6ZJsbYolDDFMhbptQNKQ6gvJCW59l2+uuOwEp82xLNgwNQPHPycTLdPHNLQY orKyZcFGXSXf4aLs1XVIe0dS3qd9TOm79pM3cOnK99lsW0/det2quftdoUhfLk/ah8 PjtzbEWfAruo0cyZDg5XW9kRcqjtSoFw1okheNzrOTjBmFKYiIaX8TmV5+2G0C3YEX 2bvX710yn69GdUlszfmH3to/DfKN72QVkJKq5315VqRUDQmu3TFumbH/ThQ5YRbja0 TMnt4MaVkN79SOBFJTkOCd/lwTeeVVLd2MRseByGfxbFrDbGLjMDHNIad+jVy0siOe bYLeP0n+i/FvQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SwN615Qxrz6twG; Wed, 20 Dec 2023 19:54:49 +0100 (CET) From: Philip Kaludercic <philipk@HIDDEN> To: "Basil L. Contovounesios" <contovob@HIDDEN> Subject: Re: bug#67916: 30.0.50; No lexical-binding directive warning in -pkg.el files In-Reply-To: <8734vwkaqi.fsf@HIDDEN> (Basil L. Contovounesios's message of "Wed, 20 Dec 2023 19:08:37 +0100") References: <87msu5q2vx.fsf@HIDDEN> <87y1dpon3v.fsf@HIDDEN> <87jzp8dhz8.fsf@HIDDEN> <8734vwkaqi.fsf@HIDDEN> Autocrypt: addr=philipk@HIDDEN; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Date: Wed, 20 Dec 2023 18:54:49 +0000 Message-ID: <87sf3wbt6u.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67916 Cc: 67916 <at> debbugs.gnu.org, Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) "Basil L. Contovounesios" <contovob@HIDDEN> writes: > Philip Kaludercic [2023-12-20 15:14 +0000] wrote: > >> "Basil L. Contovounesios" <contovob@HIDDEN> writes: >> >>> package-vc--generate-description-file currently passes: >>> :kind 'vc >>> unquoted to define-package, which results in the -pkg.el contents: >>> (define-package ... :kind vc ... :keywords '(...) ...) >>> Note the difference in quoting between :kind and :keywords. Is this >>> intentional? Or can/should :kind pass through macroexp-quote as well? >> >> This is not intentional, if anything a lucky oversight. > > Lucky in the sense that it's preferable this way, or just an accident? ;) The latter. >>> Questions for Stefan: >>> >>> - Which version of Emacs can/does elpa-admin.el assume? >> >> All I can say is that the ELPA build server, the main user of >> elpa-admin.el, has Emacs 28.2 installed. > > I'm wondering because elpa-admin.el seems to contain some compatibility > code for Emacs 26 (elpaa--select-revision, elpaa--write-pkg-file) and > Emacs versions <28 (elpaa--get-section, elpaa--html-build-doc). My guess is that it was just not removed, but I'll just let Stefan explain that. >>> (defgroup package nil >>> "Manager for Emacs Lisp packages." >>> :group 'applications >>> - :version "24.1") >>> + :group 'tools >>> + :version "30.1") >> >> I am not sure if bumping :version is necessary (here and above). > > I think it's unnecessary in the sense that I don't know of any place > where this information is displayed, but otherwise I thought it was good > form to do this since any change in :groups is user-visible. My understanding was that this information is supposed to indicate when the group was added, while each member of a group that has since been changed would have a newer :version tag. >>> (define-inline package-vc-p (pkg-desc) >>> "Return non-nil if PKG-DESC is a VC package." >>> - (inline-letevals (pkg-desc) >>> - (inline-quote (eq (package-desc-kind ,pkg-desc) 'vc)))) >>> + (inline-quote (eq (package-desc-kind ,pkg-desc) 'vc))) >>> + >>> +(define-inline package--unquote (arg) >>> + "Return ARG without its surrounding `quote', if any." >>> + (inline-letevals (arg) >>> + (inline-quote (if (eq (car-safe ,arg) 'quote) (cadr ,arg) ,arg)))) >> >> Honestly, the usage of define-inline was probably a premature >> optimisation on my part, I don't think we really need it here either. > > You mean, you prefer package--unquote being a plain function? Yes. > [ To be honest, I'm slightly inclined to add this to macroexp.el > instead, since it's a somewhat common operation. ] My only concern is that this would slightly complicate the initiative of adding package.el to GNU ELPA, if that is to proceed at all. >> You removed (require 'inline) anyway, or is it now preloaded? > > define-inline is autoloaded, and there are no other in-tree occurrences > of (require 'inline). Nevermind then. >>> +;; Potentially also used in elpa.git. >>> +(defun package--write-description-file ( file name version doc reqs extras >>> + &optional extra-props verbose) >>> + "Write a `define-package' declaration to FILE. >>> +Absolute FILE names the -pkg.el description file. >>> +NAME, VERSION, and DOC are the leading, and EXTRA-PROPS the >>> +trailing, arguments of `define-package'. >>> +REQS and EXTRAS are the eponymous `package-desc' slots. >>> +Non-nil VERBOSE means display \"Wrote file\" message." >>> + (let* ((src (replace-regexp-in-string (rx "-pkg.el" eos) ".el" >>> + (file-name-nondirectory file) t t)) >>> + (def `(define-package ,name ,version ,doc >>> + ,(macroexp-quote >>> + ;; Turn requirement version lists into string form. >>> + (mapcar (lambda (elt) >>> + (list (car elt) >>> + (package-version-join (cadr elt)))) >>> + reqs)) >>> + ,@extra-props >>> + ,@(package--alist-to-plist-args extras))) >>> + (print-cfg '((length . nil) >>> + (level . nil) >>> + (quoted . t))) >>> + (str (concat ";;; Generated package description from " src >>> + " -*- no-byte-compile: t; lexical-binding: t -*-\n" >>> + (prin1-to-string def nil print-cfg) >>> + "\n"))) >>> + (write-region str nil file nil (unless verbose 'silent)))) >> >> I like this, but we should really make sure that there are no hidden >> edge-cases that might cause problems. > > How do we find them if they're hidden? ;) > Did you have something specific in mind? IIRC there were some bugs related to the generation of -pkg.el files, but I can't find them right now. I'll ping you if I find anything. > Thanks,
bug-gnu-emacs@HIDDEN
:bug#67916
; Package emacs
.
Full text available.Received: (at 67916) by debbugs.gnu.org; 20 Dec 2023 18:08:54 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 20 13:08:53 2023 Received: from localhost ([127.0.0.1]:41745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rG101-0005G5-BX for submit <at> debbugs.gnu.org; Wed, 20 Dec 2023 13:08:53 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:57453) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <contovob@HIDDEN>) id 1rG0zw-0005Fm-L8 for 67916 <at> debbugs.gnu.org; Wed, 20 Dec 2023 13:08:52 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40d38f03712so6003645e9.2 for <67916 <at> debbugs.gnu.org>; Wed, 20 Dec 2023 10:08:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; t=1703095719; x=1703700519; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=FkivYvWxW4ASXWpcLF76eFAJr/cXOhsjNGwVJFutY+A=; b=ChBDJ8JGoALji1uosGZQE2hZFvQZqKw0R7SVxZcuhH0TQ3JFFoQvurrmzcpW/M1cqY S1q2PmNV5Oq9S9P6rhH/HjhwGEHNkwSpPv2NrPg+bWfaxjYwC6dSlm7VKp/aIUYNrqLq lG+IZkjWvZiVM3l2O+rjqNEPx3dCJHF4i1ETBfadDg8XZW5DAoCxkaXyBmRhtfaQRLXd l9Zk4w57FG7JPID1ZJTLYIyh3iuTFvK+Qoab0wMKMLQgsdcJEzx5SGBcZdM7BIkhLrLi Wmq8z/2HQec+Am/RDAL++q1vS8mvViuXsrBajhoMkrzrXjYy35Bc0arfXaMl4iY3AW6A 19hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703095719; x=1703700519; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FkivYvWxW4ASXWpcLF76eFAJr/cXOhsjNGwVJFutY+A=; b=l9Qxs6CXTLEpAF7UX5OrYRqbKE7N77AHu2Sjv9UpX6lt2t9JcJ6/uPlVSoWQ6H4a4H ZTa2yUA+dnDwKfE6sWJrycIY1v0vHyj0Zu3iIpFKzvy1TAew8n7b0z3CzVgjGb7XwuGL Yg+ENXG5+QNT3+IkOKzpkGqiyRX7MC4zLLAi2oN15/7herXW53v6lSbOUjOCHXwkfJl8 PhrP+pxADcD5dRqfX5lF6GDdtUfjV3HuiHUug6UQ6SJChZRTE0tR64rL6volovRHE2oX Gqdxy925vYw4r4hSM5m5lD2AhAN8HeuXuzUjHEV8fMjLF8KHCyxW1D8sdxin7vKBj/3f 9UeQ== X-Gm-Message-State: AOJu0Yx+wjrSXka5rMswcQoqdMHhGN0vJnArqUZWQMPpLalE9aLXCmyS Iot2zQDO58+2/Qw/DKefxvK45A== X-Google-Smtp-Source: AGHT+IFiqJPMRgBLseSbsFndVTP8o86UsEyU7LmjXvIPLQU7LBHKr4oM4KMTincWJIs0Ir8Iv6Y6gg== X-Received: by 2002:a05:600c:520b:b0:40d:3880:9a82 with SMTP id fb11-20020a05600c520b00b0040d38809a82mr45817wmb.181.1703095719040; Wed, 20 Dec 2023 10:08:39 -0800 (PST) Received: from localhost ([2001:620:618:5c0:2:80b3:0:91e]) by smtp.gmail.com with ESMTPSA id v8-20020a05600c444800b0040c2c5f5844sm408134wmn.21.2023.12.20.10.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 10:08:38 -0800 (PST) From: "Basil L. Contovounesios" <contovob@HIDDEN> To: Philip Kaludercic <philipk@HIDDEN> Subject: Re: bug#67916: 30.0.50; No lexical-binding directive warning in -pkg.el files In-Reply-To: <87jzp8dhz8.fsf@HIDDEN> (Philip Kaludercic's message of "Wed, 20 Dec 2023 15:14:03 +0000") References: <87msu5q2vx.fsf@HIDDEN> <87y1dpon3v.fsf@HIDDEN> <87jzp8dhz8.fsf@HIDDEN> Date: Wed, 20 Dec 2023 19:08:37 +0100 Message-ID: <8734vwkaqi.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 67916 Cc: 67916 <at> debbugs.gnu.org, Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Philip Kaludercic [2023-12-20 15:14 +0000] wrote: > "Basil L. Contovounesios" <contovob@HIDDEN> writes: > >> package-vc--generate-description-file currently passes: >> :kind 'vc >> unquoted to define-package, which results in the -pkg.el contents: >> (define-package ... :kind vc ... :keywords '(...) ...) >> Note the difference in quoting between :kind and :keywords. Is this >> intentional? Or can/should :kind pass through macroexp-quote as well? > > This is not intentional, if anything a lucky oversight. Lucky in the sense that it's preferable this way, or just an accident? ;) >> Questions for Stefan: >> >> - Which version of Emacs can/does elpa-admin.el assume? > > All I can say is that the ELPA build server, the main user of > elpa-admin.el, has Emacs 28.2 installed. I'm wondering because elpa-admin.el seems to contain some compatibility code for Emacs 26 (elpaa--select-revision, elpaa--write-pkg-file) and Emacs versions <28 (elpaa--get-section, elpaa--html-build-doc). >> (defgroup package nil >> "Manager for Emacs Lisp packages." >> :group 'applications >> - :version "24.1") >> + :group 'tools >> + :version "30.1") > > I am not sure if bumping :version is necessary (here and above). I think it's unnecessary in the sense that I don't know of any place where this information is displayed, but otherwise I thought it was good form to do this since any change in :groups is user-visible. >> (define-inline package-vc-p (pkg-desc) >> "Return non-nil if PKG-DESC is a VC package." >> - (inline-letevals (pkg-desc) >> - (inline-quote (eq (package-desc-kind ,pkg-desc) 'vc)))) >> + (inline-quote (eq (package-desc-kind ,pkg-desc) 'vc))) >> + >> +(define-inline package--unquote (arg) >> + "Return ARG without its surrounding `quote', if any." >> + (inline-letevals (arg) >> + (inline-quote (if (eq (car-safe ,arg) 'quote) (cadr ,arg) ,arg)))) > > Honestly, the usage of define-inline was probably a premature > optimisation on my part, I don't think we really need it here either. You mean, you prefer package--unquote being a plain function? [ To be honest, I'm slightly inclined to add this to macroexp.el instead, since it's a somewhat common operation. ] > You removed (require 'inline) anyway, or is it now preloaded? define-inline is autoloaded, and there are no other in-tree occurrences of (require 'inline). >> +;; Potentially also used in elpa.git. >> +(defun package--write-description-file ( file name version doc reqs extras >> + &optional extra-props verbose) >> + "Write a `define-package' declaration to FILE. >> +Absolute FILE names the -pkg.el description file. >> +NAME, VERSION, and DOC are the leading, and EXTRA-PROPS the >> +trailing, arguments of `define-package'. >> +REQS and EXTRAS are the eponymous `package-desc' slots. >> +Non-nil VERBOSE means display \"Wrote file\" message." >> + (let* ((src (replace-regexp-in-string (rx "-pkg.el" eos) ".el" >> + (file-name-nondirectory file) t t)) >> + (def `(define-package ,name ,version ,doc >> + ,(macroexp-quote >> + ;; Turn requirement version lists into string form. >> + (mapcar (lambda (elt) >> + (list (car elt) >> + (package-version-join (cadr elt)))) >> + reqs)) >> + ,@extra-props >> + ,@(package--alist-to-plist-args extras))) >> + (print-cfg '((length . nil) >> + (level . nil) >> + (quoted . t))) >> + (str (concat ";;; Generated package description from " src >> + " -*- no-byte-compile: t; lexical-binding: t -*-\n" >> + (prin1-to-string def nil print-cfg) >> + "\n"))) >> + (write-region str nil file nil (unless verbose 'silent)))) > > I like this, but we should really make sure that there are no hidden > edge-cases that might cause problems. How do we find them if they're hidden? ;) Did you have something specific in mind? Thanks, -- Basil
bug-gnu-emacs@HIDDEN
:bug#67916
; Package emacs
.
Full text available.Received: (at 67916) by debbugs.gnu.org; 20 Dec 2023 15:14:24 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 20 10:14:24 2023 Received: from localhost ([127.0.0.1]:41620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rFyH8-0002oI-Q6 for submit <at> debbugs.gnu.org; Wed, 20 Dec 2023 10:14:23 -0500 Received: from mout02.posteo.de ([185.67.36.66]:54195) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <philipk@HIDDEN>) id 1rFyH2-0002nz-07 for 67916 <at> debbugs.gnu.org; Wed, 20 Dec 2023 10:14:21 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 5419F240101 for <67916 <at> debbugs.gnu.org>; Wed, 20 Dec 2023 16:14:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1703085246; bh=F3Q/VtkMagA2rTYtfVlAcaSgZoJxHXd3Gx1xXqGV4h4=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=RyJIWP0KAgPNzap0La1hFJQcbUnc3HspBv9jjvMh46Vf7i/x0uH7gLZwQWMLe5WeS aQcU51lGMQi3z08hORuJda0RrR4nNnTwOpy+PoWPVYUj8GT4juko1z6pew5O4jgdxe uwICX+u5zHrO8FljspRuNaMiK5EdsIeqDlNpc4kh6ZLWDcRLtOaX5SbH2LQWz7od+D QYHaDbw5U7Sipmc86+dBC9VA6WcW5ohMW49vvMf4qrZFp9zFGTw7Kqdz4u7NCZyvZA KMpnCqfYoWD4I9MI7JlXXHGJ7LoKXr7QYceMkrA8VIvN5VQvIIk52U3Va7aHHoabLe 2PTeI9sDoN20w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SwHCK2Mjjz6tw8; Wed, 20 Dec 2023 16:14:05 +0100 (CET) From: Philip Kaludercic <philipk@HIDDEN> To: "Basil L. Contovounesios" <contovob@HIDDEN> Subject: Re: bug#67916: 30.0.50; No lexical-binding directive warning in -pkg.el files In-Reply-To: <87y1dpon3v.fsf@HIDDEN> (Basil L. Contovounesios's message of "Tue, 19 Dec 2023 23:15:32 +0100") References: <87msu5q2vx.fsf@HIDDEN> <87y1dpon3v.fsf@HIDDEN> Autocrypt: addr=philipk@HIDDEN; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Date: Wed, 20 Dec 2023 15:14:03 +0000 Message-ID: <87jzp8dhz8.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67916 Cc: 67916 <at> debbugs.gnu.org, Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) "Basil L. Contovounesios" <contovob@HIDDEN> writes: > tags 67916 + patch > quit > > Basil L. Contovounesios [2023-12-19 22:49 +0100] wrote: >> WDYT? Couple of sample patches to follow. > > I attach a patch each for emacs.git and elpa.git. > > Their main intention was emitting a lexical-binding cookie in -pkg.el > files, but even if we decide against that, the patches contain some > other cleanups which are hopefully welcome. > > Question for Philip: > > package-vc--generate-description-file currently passes: > :kind 'vc > unquoted to define-package, which results in the -pkg.el contents: > (define-package ... :kind vc ... :keywords '(...) ...) > Note the difference in quoting between :kind and :keywords. Is this > intentional? Or can/should :kind pass through macroexp-quote as well? This is not intentional, if anything a lucky oversight. > Questions for Stefan: > > - Which version of Emacs can/does elpa-admin.el assume? All I can say is that the ELPA build server, the main user of elpa-admin.el, has Emacs 28.2 installed. > - When the FIXME in elpaa--write-pkg-file says to use > package-generate-description-file, does that mean reuse its guts like > I did in package-vc.el with package--write-description-file? Or was > the idea rather to have elpaa--write-pkg-file create synthetic > package-desc structs for passing to the public API of > package-generate-description-file directly? > > Thanks, > -- > Basil > > From e602e79c00f2c4515c31b3f4ae744e63b7192174 Mon Sep 17 00:00:00 2001 > From: "Basil L. Contovounesios" <contovob@HIDDEN> > Date: Mon, 18 Dec 2023 13:27:39 +0100 > Subject: [PATCH] Declare lexical-binding in -pkg.el files > > Running package-install emits a 'has no lexical-binding directive' > warning for generated -pkg.el files. > > * lisp/emacs-lisp/package.el: > (package--with-response-buffer-1): Remove redundant requires and > function declarations. > (package): Add to tools :group as per Keywords header. Bump > :version accordingly. > (package-vc-p): Remove redundant inline-letevals. > (package--unquote): New convenience function. > (package-desc-from-define, package-desc-suffix): Use it. > (package-desc): Add individual :type and :documentation options to > slots. Document dir and vc kinds. > (package--alist-to-plist-args): Replace nconc+mapcar with mapcan. > (package--write-description-file): New function extracted from > package-generate-description-file. Specify lexical-binding to avoid > package-install warnings (bug#67916). Stricter calls to prin1 and > replace-regexp-in-string with overriding arguments. Use > macroexp-quote. > (package-generate-description-file): Refactor in terms of > package--write-description-file. > > * lisp/emacs-lisp/package-vc.el: Add development and vc Keywords. > Remove redundant requires. > (package-vc): Add to vc :group and bump :version accordingly. > (package-vc--main-file): Simplify. > (package-vc--generate-description-file): Simplify and refactor in > terms of package--write-description-file. > (package-vc--unpack): Use package-vc-p. > --- > lisp/emacs-lisp/package-vc.el | 78 +++++---------- > lisp/emacs-lisp/package.el | 182 ++++++++++++++++------------------ > 2 files changed, 110 insertions(+), 150 deletions(-) > > diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el > index bef498f997c..14f3dc859bf 100644 > --- a/lisp/emacs-lisp/package-vc.el > +++ b/lisp/emacs-lisp/package-vc.el > @@ -3,7 +3,7 @@ > ;; Copyright (C) 2022-2023 Free Software Foundation, Inc. > > ;; Author: Philip Kaludercic <philipk@HIDDEN> > -;; Keywords: tools > +;; Keywords: development, tools, vc > > ;; This file is part of GNU Emacs. > > @@ -44,20 +44,19 @@ > > ;;; Code: > > -(eval-when-compile (require 'rx)) > (eval-when-compile (require 'map)) > (eval-when-compile (require 'cl-lib)) > (require 'package) > (require 'lisp-mnt) > (require 'vc) > -(require 'seq) > > (defgroup package-vc nil > "Manage packages from VC checkouts." > :group 'package > + :group 'vc > :link '(custom-manual "(emacs) Fetching Package Sources") > :prefix "package-vc-" > - :version "29.1") > + :version "30.1") > > (defconst package-vc--elpa-packages-version 1 > "Version number of the package specification format understood by package-vc.") > @@ -308,59 +307,32 @@ package-vc--main-file > ;; try and find the closest match. > (let ((distance most-positive-fixnum) (best nil)) > (dolist (alt (directory-files directory t "\\.el\\'" t)) > - (let ((sd (string-distance file alt))) > - (when (and (not (string-match-p (rx (or (: "-autoloads.el") > - (: "-pkg.el")) > - eos) > - alt)) > - (< sd distance)) > + (unless (or (string-suffix-p "-autoloads.el" alt) > + (string-suffix-p "-pkg.el" alt)) > + (let ((sd (string-distance file alt))) > (when (< sd distance) > - (setq distance (string-distance file alt) > - best alt))))) > + (setq distance sd best alt))))) > best)))) > > (defun package-vc--generate-description-file (pkg-desc pkg-file) > "Generate a package description file for PKG-DESC and write it to PKG-FILE." > - (let ((name (package-desc-name pkg-desc))) > - ;; Infer the subject if missing. > - (unless (package-desc-summary pkg-desc) > - (setf (package-desc-summary pkg-desc) > - (let ((main-file (package-vc--main-file pkg-desc))) > - (or (package-desc-summary pkg-desc) > - (and-let* ((pkg (cadr (assq name package-archive-contents)))) > - (package-desc-summary pkg)) > - (and main-file (file-exists-p main-file) > - (lm-summary main-file)) > - package--default-summary)))) > - (let ((print-level nil) > - (print-quoted t) > - (print-length nil)) > - (write-region > - (concat > - ";;; Generated package description from " > - (replace-regexp-in-string > - "-pkg\\.el\\'" ".el" > - (file-name-nondirectory pkg-file)) > - " -*- no-byte-compile: t -*-\n" > - (prin1-to-string > - (nconc > - (list 'define-package > - (symbol-name name) > - (package-vc--version pkg-desc) > - (package-desc-summary pkg-desc) > - (let ((requires (package-desc-reqs pkg-desc))) > - (list 'quote > - ;; Turn version lists into string form. > - (mapcar > - (lambda (elt) > - (list (car elt) > - (package-version-join (cadr elt)))) > - requires)))) > - (list :kind 'vc) > - (package--alist-to-plist-args > - (package-desc-extras pkg-desc)))) > - "\n") > - nil pkg-file nil 'silent)))) > + ;; Infer the subject if missing. > + (unless (package-desc-summary pkg-desc) > + (setf (package-desc-summary pkg-desc) > + (or (and-let* ((pkg (cadr (assq (package-desc-name pkg-desc) > + package-archive-contents)))) > + (package-desc-summary pkg)) > + (and-let* ((main-file (package-vc--main-file pkg-desc)) > + ((file-exists-p main-file))) > + (lm-summary main-file)) > + package--default-summary))) > + (let ((name (symbol-name (package-desc-name pkg-desc))) > + (ver (package-vc--version pkg-desc)) > + (doc (package-desc-summary pkg-desc)) > + (reqs (package-desc-reqs pkg-desc)) > + (extras (package-desc-extras pkg-desc)) > + (props '(:kind vc))) > + (package--write-description-file pkg-file name ver doc reqs extras props))) > > (defcustom package-vc-allow-build-commands nil > "Whether to run extra build commands when installing VC packages. > @@ -674,7 +646,7 @@ package-vc--unpack > how to fetch and build the package. See `package-vc--archive-spec-alists' > for details. The optional argument REV specifies a specific revision to > checkout. This overrides the `:branch' attribute in PKG-SPEC." > - (unless (eq (package-desc-kind pkg-desc) 'vc) > + (unless (package-vc-p pkg-desc) > (let ((copy (copy-package-desc pkg-desc))) > (setf (package-desc-kind copy) 'vc > pkg-desc copy))) > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el > index bed6e74c921..d1ff6e67a8a 100644 > --- a/lisp/emacs-lisp/package.el > +++ b/lisp/emacs-lisp/package.el > @@ -144,20 +144,17 @@ > ;;; Code: > > (require 'cl-lib) > -(eval-when-compile (require 'subr-x)) > (eval-when-compile (require 'epg)) ;For setf accessors. > -(eval-when-compile (require 'inline)) ;For `define-inline' > -(require 'seq) > > (require 'tabulated-list) > -(require 'macroexp) > (require 'url-handlers) > (require 'browse-url) > > (defgroup package nil > "Manager for Emacs Lisp packages." > :group 'applications > - :version "24.1") > + :group 'tools > + :version "30.1") I am not sure if bumping :version is necessary (here and above). > > ;;; Customization options > @@ -325,9 +322,6 @@ package-directory-list > :risky t > :version "24.1") > > -(declare-function epg-find-configuration "epg-config" > - (protocol &optional no-cache program-alist)) > - > (defcustom package-gnupghome-dir (expand-file-name "gnupg" package-user-dir) > "Directory containing GnuPG keyring or nil. > This variable specifies the GnuPG home directory used by package. > @@ -457,14 +451,18 @@ package--default-summary > > (define-inline package-vc-p (pkg-desc) > "Return non-nil if PKG-DESC is a VC package." > - (inline-letevals (pkg-desc) > - (inline-quote (eq (package-desc-kind ,pkg-desc) 'vc)))) > + (inline-quote (eq (package-desc-kind ,pkg-desc) 'vc))) > + > +(define-inline package--unquote (arg) > + "Return ARG without its surrounding `quote', if any." > + (inline-letevals (arg) > + (inline-quote (if (eq (car-safe ,arg) 'quote) (cadr ,arg) ,arg)))) Honestly, the usage of define-inline was probably a premature optimisation on my part, I don't think we really need it here either. You removed (require 'inline) anyway, or is it now preloaded? > (cl-defstruct (package-desc > ;; Rename the default constructor from `make-package-desc'. > (:constructor package-desc-create) > ;; Has the same interface as the old `define-package', > - ;; which is still used in the "foo-pkg.el" files. Extra > + ;; which is still used in the "foo-pkg.el" files. Extra > ;; options can be supported by adding additional keys. > (:constructor > package-desc-from-define > @@ -472,15 +470,14 @@ package-vc-p > &rest rest-plist > &aux > (name (intern name-string)) > - (version (if (eq (car-safe version-string) 'vc) > - (version-to-list (cdr version-string)) > - (version-to-list version-string))) > + (version (version-to-list > + (if (eq (car-safe version-string) 'vc) > + (cdr version-string) > + version-string))) > (reqs (mapcar (lambda (elt) > (list (car elt) > (version-to-list (cadr elt)))) > - (if (eq 'quote (car requirements)) > - (nth 1 requirements) > - requirements))) > + (package--unquote requirements))) > (kind (plist-get rest-plist :kind)) > (archive (plist-get rest-plist :archive)) > (extras (let (alist) > @@ -489,47 +486,42 @@ package-vc-p > (let ((value (cadr rest-plist))) > (when value > (push (cons (car rest-plist) > - (if (eq (car-safe value) 'quote) > - (cadr value) > - value)) > + (package--unquote value)) > alist)))) > (setq rest-plist (cddr rest-plist))) > alist))))) > - "Structure containing information about an individual package. > -Slots: > - > -`name' Name of the package, as a symbol. > - > -`version' Version of the package, as a version list. > - > -`summary' Short description of the package, typically taken from > - the first line of the file. > - > -`reqs' Requirements of the package. A list of (PACKAGE > - VERSION-LIST) naming the dependent package and the minimum > - required version. > - > -`kind' The distribution format of the package. Currently, it is > - either `single' or `tar'. > - > -`archive' The name of the archive (as a string) whence this > - package came. > - > -`dir' The directory where the package is installed (if installed), > - `builtin' if it is built-in, or nil otherwise. > - > -`extras' Optional alist of additional keyword-value pairs. > - > -`signed' Flag to indicate that the package is signed by provider." > - name > - version > - (summary package--default-summary) > - reqs > - kind > - archive > - dir > - extras > - signed) > + "Structure containing information about an individual package." > + (name > + nil :type symbol :documentation > + "Name of the package.") > + (version > + () :type list :documentation > + "Version of the package, as a version list.") > + (summary > + package--default-summary :type string :documentation > + "Short description of the package, typically taken from the first > +line of the file.") > + (reqs > + () :type list :documentation > + "Requirements of the package. A list of (PACKAGE VERSION-LIST) > +naming the dependent package and the minimum required version.") > + (kind > + nil :type symbol :documentation > + "The distribution format of the package. Currently, it is one of > +`single', `tar', `dir', or `vc'.") > + (archive > + nil :type string :documentation > + "The name of the archive whence this package came.") > + (dir > + nil :type (or string symbol) :documentation > + "The directory where the package is installed (if installed), > +`builtin' if it is built-in, or nil otherwise." ) > + (extras > + () :type list :documentation > + "Optional alist of additional keyword-value pairs.") > + (signed > + nil :type boolean :documentation > + "Flag to indicate that the package is signed by provider.")) > > (defun package--from-builtin (bi-desc) > "Create a `package-desc' object from BI-DESC. > @@ -597,12 +589,9 @@ package-desc-suffix > (defun package-desc--keywords (pkg-desc) > "Return keywords of package-desc object PKG-DESC. > These keywords come from the foo-pkg.el file, and in general > -corresponds to the keywords in the \"Keywords\" header of the > +correspond to the keywords in the \"Keywords\" header of the > package." > - (let ((keywords (cdr (assoc :keywords (package-desc-extras pkg-desc))))) > - (if (eq (car-safe keywords) 'quote) > - (nth 1 keywords) > - keywords))) > + (package--unquote (cdr (assq :keywords (package-desc-extras pkg-desc))))) > > (defun package-desc-priority (pkg-desc) > "Return the priority of the archive of package-desc object PKG-DESC." > @@ -978,8 +967,7 @@ package-untar-buffer > > (defun package--alist-to-plist-args (alist) > (mapcar #'macroexp-quote > - (apply #'nconc > - (mapcar (lambda (pair) (list (car pair) (cdr pair))) alist)))) > + (mapcan (lambda (pair) (list (car pair) (cdr pair))) alist))) > > (defun package-unpack (pkg-desc) > "Install the contents of the current buffer as a package." > @@ -1032,37 +1020,43 @@ package-unpack > (package--reload-previously-loaded new-desc))) > pkg-dir)) > > +;; Potentially also used in elpa.git. > +(defun package--write-description-file ( file name version doc reqs extras > + &optional extra-props verbose) > + "Write a `define-package' declaration to FILE. > +Absolute FILE names the -pkg.el description file. > +NAME, VERSION, and DOC are the leading, and EXTRA-PROPS the > +trailing, arguments of `define-package'. > +REQS and EXTRAS are the eponymous `package-desc' slots. > +Non-nil VERBOSE means display \"Wrote file\" message." > + (let* ((src (replace-regexp-in-string (rx "-pkg.el" eos) ".el" > + (file-name-nondirectory file) t t)) > + (def `(define-package ,name ,version ,doc > + ,(macroexp-quote > + ;; Turn requirement version lists into string form. > + (mapcar (lambda (elt) > + (list (car elt) > + (package-version-join (cadr elt)))) > + reqs)) > + ,@extra-props > + ,@(package--alist-to-plist-args extras))) > + (print-cfg '((length . nil) > + (level . nil) > + (quoted . t))) > + (str (concat ";;; Generated package description from " src > + " -*- no-byte-compile: t; lexical-binding: t -*-\n" > + (prin1-to-string def nil print-cfg) > + "\n"))) > + (write-region str nil file nil (unless verbose 'silent)))) I like this, but we should really make sure that there are no hidden edge-cases that might cause problems. > + > (defun package-generate-description-file (pkg-desc pkg-file) > "Create the foo-pkg.el file PKG-FILE for single-file package PKG-DESC." > - (let* ((name (package-desc-name pkg-desc))) > - (let ((print-level nil) > - (print-quoted t) > - (print-length nil)) > - (write-region > - (concat > - ";;; Generated package description from " > - (replace-regexp-in-string "-pkg\\.el\\'" ".el" > - (file-name-nondirectory pkg-file)) > - " -*- no-byte-compile: t -*-\n" > - (prin1-to-string > - (nconc > - (list 'define-package > - (symbol-name name) > - (package-version-join (package-desc-version pkg-desc)) > - (package-desc-summary pkg-desc) > - (let ((requires (package-desc-reqs pkg-desc))) > - (list 'quote > - ;; Turn version lists into string form. > - (mapcar > - (lambda (elt) > - (list (car elt) > - (package-version-join (cadr elt)))) > - requires)))) > - (package--alist-to-plist-args > - (package-desc-extras pkg-desc)))) > - "\n") > - nil pkg-file nil 'silent)))) > - > + (let ((name (symbol-name (package-desc-name pkg-desc))) > + (ver (package-version-join (package-desc-version pkg-desc))) > + (doc (package-desc-summary pkg-desc)) > + (reqs (package-desc-reqs pkg-desc)) > + (extras (package-desc-extras pkg-desc))) > + (package--write-description-file pkg-file name ver doc reqs extras))) > > ;;;; Autoload > (declare-function autoload-rubric "autoload" (file &optional type feature)) > @@ -1311,11 +1305,6 @@ package--archive-file-exists-p > (url-http-file-exists-p (concat location file))) > (file-exists-p (expand-file-name file location))))) > > -(declare-function epg-make-context "epg" > - (&optional protocol armor textmode include-certs > - cipher-algorithm > - digest-algorithm > - compress-algorithm)) > (declare-function epg-verify-string "epg" ( context signature > &optional signed-text)) > (declare-function epg-context-result-for "epg" (context name)) > @@ -1397,7 +1386,6 @@ package--with-response-buffer-1 > url > (lambda (status) > (let ((b (current-buffer))) > - (require 'url-handlers) > (package--unless-error body > (when-let* ((er (plist-get status :error))) > (error "Error retrieving: %s %S" url er))
bug-gnu-emacs@HIDDEN
:bug#67916
; Package emacs
.
Full text available."Basil L. Contovounesios" <contovob@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 67916) by debbugs.gnu.org; 19 Dec 2023 22:15:52 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 19 17:15:51 2023 Received: from localhost ([127.0.0.1]:37769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rFiNR-0002Gu-Q9 for submit <at> debbugs.gnu.org; Tue, 19 Dec 2023 17:15:51 -0500 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:61573) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <contovob@HIDDEN>) id 1rFiNL-0001yd-T9 for 67916 <at> debbugs.gnu.org; Tue, 19 Dec 2023 17:15:45 -0500 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a2335397e64so418990166b.2 for <67916 <at> debbugs.gnu.org>; Tue, 19 Dec 2023 14:15:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; t=1703024134; x=1703628934; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=NsZE7e2MCv3Z5v+OFLYDcS1gPncvGQpXlcmYBZA8Zlo=; b=DtX5XmDvOFbdPr+lmHHAs3P3l9V+1bwM9v0by/jHL/mw6uKBJn3ZxFIX2B38Y4bJbu uKrk/qCReGVqcvkAacEbr1FoTd+Xp+0hyAeucUshpNqjcMTO91NNy2wonHx8O4qLa2ng iBauvGrwq//xzluEfKoR/vor/oRr0t8oYtU9B2JTwrp1NgTQzlNKIA/i+WTFIt2JJEEO mixHcDUBsEU8j0tzPnhOnh3/xm9KS9ML1zF1VGK6EKEx2rPLUXwRpf6c72z4vN9jzD7y JJOXwYONSCawwdt1Q8Nk+mqNb3sCNgQXliY1kpYZAbT4sGrHl08tt7vIU/MbYbAOnqJG 9RjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703024134; x=1703628934; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NsZE7e2MCv3Z5v+OFLYDcS1gPncvGQpXlcmYBZA8Zlo=; b=WGPD261Fri8Jv7e36E9MPQC5eI1Q18GfBskf6yh4tORPYmNhJ3hZ321mSfp83xC1gL YfbwS4Yh9nXYUO/9ae32jmtq5PqHnKcXIRuRmGOb0XbScDOZSlFuxmn82wOrgAByI1GG gihxkMWyDvQ4/1xFOGiXhKu4o2j4Kzq6CnKC8FzF2QYfY+ctM/z1W0/+FmfmUGUW8qIo W6hjM5TlUww2+Fku9ipvs4r/GdU3YisCmAAGlmb/JFKKWEp0Xfd6OqHFV2zEU6XVQNy5 8HGjpdf22vMUDKAuZpIz8+wuJs6zCzJcNnj50DRSwIghBXm/H8jNEyoulg5vBoRX4A/A jxgw== X-Gm-Message-State: AOJu0YwnXCyx/p8NTxnXOxFTeOJRXoP5xO9eEXfjQ0ANajoKdz9h3oJj maeFagRyhe0ayAFtK/snEHdAnxIGXOIFpxcDB/I= X-Google-Smtp-Source: AGHT+IEilbJ8bsntyGmyLxKGf6OsvSIP3rihY6TRhiv5cyyUftiX/zS/UZBjD8xn4EB3DZyjrKBl8A== X-Received: by 2002:a17:906:1de:b0:a23:5a0a:aeba with SMTP id 30-20020a17090601de00b00a235a0aaebamr2062059ejj.68.1703024134519; Tue, 19 Dec 2023 14:15:34 -0800 (PST) Received: from localhost ([2001:620:618:5c0:2:80b3:0:42]) by smtp.gmail.com with ESMTPSA id u8-20020a170906c40800b00a25f5dba09dsm996560ejz.145.2023.12.19.14.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 14:15:33 -0800 (PST) From: "Basil L. Contovounesios" <contovob@HIDDEN> To: 67916 <at> debbugs.gnu.org Subject: Re: bug#67916: 30.0.50; No lexical-binding directive warning in -pkg.el files In-Reply-To: <87msu5q2vx.fsf@HIDDEN> (Basil L. Contovounesios" via "Bug reports for GNU Emacs, the Swiss army knife of text editors's message of "Tue, 19 Dec 2023 22:49:22 +0100") References: <87msu5q2vx.fsf@HIDDEN> Date: Tue, 19 Dec 2023 23:15:32 +0100 Message-ID: <87y1dpon3v.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 67916 Cc: Philip Kaludercic <philipk@HIDDEN>, =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain tags 67916 + patch quit Basil L. Contovounesios [2023-12-19 22:49 +0100] wrote: > WDYT? Couple of sample patches to follow. I attach a patch each for emacs.git and elpa.git. Their main intention was emitting a lexical-binding cookie in -pkg.el files, but even if we decide against that, the patches contain some other cleanups which are hopefully welcome. Question for Philip: package-vc--generate-description-file currently passes: :kind 'vc unquoted to define-package, which results in the -pkg.el contents: (define-package ... :kind vc ... :keywords '(...) ...) Note the difference in quoting between :kind and :keywords. Is this intentional? Or can/should :kind pass through macroexp-quote as well? Questions for Stefan: - Which version of Emacs can/does elpa-admin.el assume? - When the FIXME in elpaa--write-pkg-file says to use package-generate-description-file, does that mean reuse its guts like I did in package-vc.el with package--write-description-file? Or was the idea rather to have elpaa--write-pkg-file create synthetic package-desc structs for passing to the public API of package-generate-description-file directly? Thanks, -- Basil --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Declare-lexical-binding-in-pkg.el-files.patch From e602e79c00f2c4515c31b3f4ae744e63b7192174 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" <contovob@HIDDEN> Date: Mon, 18 Dec 2023 13:27:39 +0100 Subject: [PATCH] Declare lexical-binding in -pkg.el files Running package-install emits a 'has no lexical-binding directive' warning for generated -pkg.el files. * lisp/emacs-lisp/package.el: (package--with-response-buffer-1): Remove redundant requires and function declarations. (package): Add to tools :group as per Keywords header. Bump :version accordingly. (package-vc-p): Remove redundant inline-letevals. (package--unquote): New convenience function. (package-desc-from-define, package-desc-suffix): Use it. (package-desc): Add individual :type and :documentation options to slots. Document dir and vc kinds. (package--alist-to-plist-args): Replace nconc+mapcar with mapcan. (package--write-description-file): New function extracted from package-generate-description-file. Specify lexical-binding to avoid package-install warnings (bug#67916). Stricter calls to prin1 and replace-regexp-in-string with overriding arguments. Use macroexp-quote. (package-generate-description-file): Refactor in terms of package--write-description-file. * lisp/emacs-lisp/package-vc.el: Add development and vc Keywords. Remove redundant requires. (package-vc): Add to vc :group and bump :version accordingly. (package-vc--main-file): Simplify. (package-vc--generate-description-file): Simplify and refactor in terms of package--write-description-file. (package-vc--unpack): Use package-vc-p. --- lisp/emacs-lisp/package-vc.el | 78 +++++---------- lisp/emacs-lisp/package.el | 182 ++++++++++++++++------------------ 2 files changed, 110 insertions(+), 150 deletions(-) diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index bef498f997c..14f3dc859bf 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2022-2023 Free Software Foundation, Inc. ;; Author: Philip Kaludercic <philipk@HIDDEN> -;; Keywords: tools +;; Keywords: development, tools, vc ;; This file is part of GNU Emacs. @@ -44,20 +44,19 @@ ;;; Code: -(eval-when-compile (require 'rx)) (eval-when-compile (require 'map)) (eval-when-compile (require 'cl-lib)) (require 'package) (require 'lisp-mnt) (require 'vc) -(require 'seq) (defgroup package-vc nil "Manage packages from VC checkouts." :group 'package + :group 'vc :link '(custom-manual "(emacs) Fetching Package Sources") :prefix "package-vc-" - :version "29.1") + :version "30.1") (defconst package-vc--elpa-packages-version 1 "Version number of the package specification format understood by package-vc.") @@ -308,59 +307,32 @@ package-vc--main-file ;; try and find the closest match. (let ((distance most-positive-fixnum) (best nil)) (dolist (alt (directory-files directory t "\\.el\\'" t)) - (let ((sd (string-distance file alt))) - (when (and (not (string-match-p (rx (or (: "-autoloads.el") - (: "-pkg.el")) - eos) - alt)) - (< sd distance)) + (unless (or (string-suffix-p "-autoloads.el" alt) + (string-suffix-p "-pkg.el" alt)) + (let ((sd (string-distance file alt))) (when (< sd distance) - (setq distance (string-distance file alt) - best alt))))) + (setq distance sd best alt))))) best)))) (defun package-vc--generate-description-file (pkg-desc pkg-file) "Generate a package description file for PKG-DESC and write it to PKG-FILE." - (let ((name (package-desc-name pkg-desc))) - ;; Infer the subject if missing. - (unless (package-desc-summary pkg-desc) - (setf (package-desc-summary pkg-desc) - (let ((main-file (package-vc--main-file pkg-desc))) - (or (package-desc-summary pkg-desc) - (and-let* ((pkg (cadr (assq name package-archive-contents)))) - (package-desc-summary pkg)) - (and main-file (file-exists-p main-file) - (lm-summary main-file)) - package--default-summary)))) - (let ((print-level nil) - (print-quoted t) - (print-length nil)) - (write-region - (concat - ";;; Generated package description from " - (replace-regexp-in-string - "-pkg\\.el\\'" ".el" - (file-name-nondirectory pkg-file)) - " -*- no-byte-compile: t -*-\n" - (prin1-to-string - (nconc - (list 'define-package - (symbol-name name) - (package-vc--version pkg-desc) - (package-desc-summary pkg-desc) - (let ((requires (package-desc-reqs pkg-desc))) - (list 'quote - ;; Turn version lists into string form. - (mapcar - (lambda (elt) - (list (car elt) - (package-version-join (cadr elt)))) - requires)))) - (list :kind 'vc) - (package--alist-to-plist-args - (package-desc-extras pkg-desc)))) - "\n") - nil pkg-file nil 'silent)))) + ;; Infer the subject if missing. + (unless (package-desc-summary pkg-desc) + (setf (package-desc-summary pkg-desc) + (or (and-let* ((pkg (cadr (assq (package-desc-name pkg-desc) + package-archive-contents)))) + (package-desc-summary pkg)) + (and-let* ((main-file (package-vc--main-file pkg-desc)) + ((file-exists-p main-file))) + (lm-summary main-file)) + package--default-summary))) + (let ((name (symbol-name (package-desc-name pkg-desc))) + (ver (package-vc--version pkg-desc)) + (doc (package-desc-summary pkg-desc)) + (reqs (package-desc-reqs pkg-desc)) + (extras (package-desc-extras pkg-desc)) + (props '(:kind vc))) + (package--write-description-file pkg-file name ver doc reqs extras props))) (defcustom package-vc-allow-build-commands nil "Whether to run extra build commands when installing VC packages. @@ -674,7 +646,7 @@ package-vc--unpack how to fetch and build the package. See `package-vc--archive-spec-alists' for details. The optional argument REV specifies a specific revision to checkout. This overrides the `:branch' attribute in PKG-SPEC." - (unless (eq (package-desc-kind pkg-desc) 'vc) + (unless (package-vc-p pkg-desc) (let ((copy (copy-package-desc pkg-desc))) (setf (package-desc-kind copy) 'vc pkg-desc copy))) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index bed6e74c921..d1ff6e67a8a 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -144,20 +144,17 @@ ;;; Code: (require 'cl-lib) -(eval-when-compile (require 'subr-x)) (eval-when-compile (require 'epg)) ;For setf accessors. -(eval-when-compile (require 'inline)) ;For `define-inline' -(require 'seq) (require 'tabulated-list) -(require 'macroexp) (require 'url-handlers) (require 'browse-url) (defgroup package nil "Manager for Emacs Lisp packages." :group 'applications - :version "24.1") + :group 'tools + :version "30.1") ;;; Customization options @@ -325,9 +322,6 @@ package-directory-list :risky t :version "24.1") -(declare-function epg-find-configuration "epg-config" - (protocol &optional no-cache program-alist)) - (defcustom package-gnupghome-dir (expand-file-name "gnupg" package-user-dir) "Directory containing GnuPG keyring or nil. This variable specifies the GnuPG home directory used by package. @@ -457,14 +451,18 @@ package--default-summary (define-inline package-vc-p (pkg-desc) "Return non-nil if PKG-DESC is a VC package." - (inline-letevals (pkg-desc) - (inline-quote (eq (package-desc-kind ,pkg-desc) 'vc)))) + (inline-quote (eq (package-desc-kind ,pkg-desc) 'vc))) + +(define-inline package--unquote (arg) + "Return ARG without its surrounding `quote', if any." + (inline-letevals (arg) + (inline-quote (if (eq (car-safe ,arg) 'quote) (cadr ,arg) ,arg)))) (cl-defstruct (package-desc ;; Rename the default constructor from `make-package-desc'. (:constructor package-desc-create) ;; Has the same interface as the old `define-package', - ;; which is still used in the "foo-pkg.el" files. Extra + ;; which is still used in the "foo-pkg.el" files. Extra ;; options can be supported by adding additional keys. (:constructor package-desc-from-define @@ -472,15 +470,14 @@ package-vc-p &rest rest-plist &aux (name (intern name-string)) - (version (if (eq (car-safe version-string) 'vc) - (version-to-list (cdr version-string)) - (version-to-list version-string))) + (version (version-to-list + (if (eq (car-safe version-string) 'vc) + (cdr version-string) + version-string))) (reqs (mapcar (lambda (elt) (list (car elt) (version-to-list (cadr elt)))) - (if (eq 'quote (car requirements)) - (nth 1 requirements) - requirements))) + (package--unquote requirements))) (kind (plist-get rest-plist :kind)) (archive (plist-get rest-plist :archive)) (extras (let (alist) @@ -489,47 +486,42 @@ package-vc-p (let ((value (cadr rest-plist))) (when value (push (cons (car rest-plist) - (if (eq (car-safe value) 'quote) - (cadr value) - value)) + (package--unquote value)) alist)))) (setq rest-plist (cddr rest-plist))) alist))))) - "Structure containing information about an individual package. -Slots: - -`name' Name of the package, as a symbol. - -`version' Version of the package, as a version list. - -`summary' Short description of the package, typically taken from - the first line of the file. - -`reqs' Requirements of the package. A list of (PACKAGE - VERSION-LIST) naming the dependent package and the minimum - required version. - -`kind' The distribution format of the package. Currently, it is - either `single' or `tar'. - -`archive' The name of the archive (as a string) whence this - package came. - -`dir' The directory where the package is installed (if installed), - `builtin' if it is built-in, or nil otherwise. - -`extras' Optional alist of additional keyword-value pairs. - -`signed' Flag to indicate that the package is signed by provider." - name - version - (summary package--default-summary) - reqs - kind - archive - dir - extras - signed) + "Structure containing information about an individual package." + (name + nil :type symbol :documentation + "Name of the package.") + (version + () :type list :documentation + "Version of the package, as a version list.") + (summary + package--default-summary :type string :documentation + "Short description of the package, typically taken from the first +line of the file.") + (reqs + () :type list :documentation + "Requirements of the package. A list of (PACKAGE VERSION-LIST) +naming the dependent package and the minimum required version.") + (kind + nil :type symbol :documentation + "The distribution format of the package. Currently, it is one of +`single', `tar', `dir', or `vc'.") + (archive + nil :type string :documentation + "The name of the archive whence this package came.") + (dir + nil :type (or string symbol) :documentation + "The directory where the package is installed (if installed), +`builtin' if it is built-in, or nil otherwise." ) + (extras + () :type list :documentation + "Optional alist of additional keyword-value pairs.") + (signed + nil :type boolean :documentation + "Flag to indicate that the package is signed by provider.")) (defun package--from-builtin (bi-desc) "Create a `package-desc' object from BI-DESC. @@ -597,12 +589,9 @@ package-desc-suffix (defun package-desc--keywords (pkg-desc) "Return keywords of package-desc object PKG-DESC. These keywords come from the foo-pkg.el file, and in general -corresponds to the keywords in the \"Keywords\" header of the +correspond to the keywords in the \"Keywords\" header of the package." - (let ((keywords (cdr (assoc :keywords (package-desc-extras pkg-desc))))) - (if (eq (car-safe keywords) 'quote) - (nth 1 keywords) - keywords))) + (package--unquote (cdr (assq :keywords (package-desc-extras pkg-desc))))) (defun package-desc-priority (pkg-desc) "Return the priority of the archive of package-desc object PKG-DESC." @@ -978,8 +967,7 @@ package-untar-buffer (defun package--alist-to-plist-args (alist) (mapcar #'macroexp-quote - (apply #'nconc - (mapcar (lambda (pair) (list (car pair) (cdr pair))) alist)))) + (mapcan (lambda (pair) (list (car pair) (cdr pair))) alist))) (defun package-unpack (pkg-desc) "Install the contents of the current buffer as a package." @@ -1032,37 +1020,43 @@ package-unpack (package--reload-previously-loaded new-desc))) pkg-dir)) +;; Potentially also used in elpa.git. +(defun package--write-description-file ( file name version doc reqs extras + &optional extra-props verbose) + "Write a `define-package' declaration to FILE. +Absolute FILE names the -pkg.el description file. +NAME, VERSION, and DOC are the leading, and EXTRA-PROPS the +trailing, arguments of `define-package'. +REQS and EXTRAS are the eponymous `package-desc' slots. +Non-nil VERBOSE means display \"Wrote file\" message." + (let* ((src (replace-regexp-in-string (rx "-pkg.el" eos) ".el" + (file-name-nondirectory file) t t)) + (def `(define-package ,name ,version ,doc + ,(macroexp-quote + ;; Turn requirement version lists into string form. + (mapcar (lambda (elt) + (list (car elt) + (package-version-join (cadr elt)))) + reqs)) + ,@extra-props + ,@(package--alist-to-plist-args extras))) + (print-cfg '((length . nil) + (level . nil) + (quoted . t))) + (str (concat ";;; Generated package description from " src + " -*- no-byte-compile: t; lexical-binding: t -*-\n" + (prin1-to-string def nil print-cfg) + "\n"))) + (write-region str nil file nil (unless verbose 'silent)))) + (defun package-generate-description-file (pkg-desc pkg-file) "Create the foo-pkg.el file PKG-FILE for single-file package PKG-DESC." - (let* ((name (package-desc-name pkg-desc))) - (let ((print-level nil) - (print-quoted t) - (print-length nil)) - (write-region - (concat - ";;; Generated package description from " - (replace-regexp-in-string "-pkg\\.el\\'" ".el" - (file-name-nondirectory pkg-file)) - " -*- no-byte-compile: t -*-\n" - (prin1-to-string - (nconc - (list 'define-package - (symbol-name name) - (package-version-join (package-desc-version pkg-desc)) - (package-desc-summary pkg-desc) - (let ((requires (package-desc-reqs pkg-desc))) - (list 'quote - ;; Turn version lists into string form. - (mapcar - (lambda (elt) - (list (car elt) - (package-version-join (cadr elt)))) - requires)))) - (package--alist-to-plist-args - (package-desc-extras pkg-desc)))) - "\n") - nil pkg-file nil 'silent)))) - + (let ((name (symbol-name (package-desc-name pkg-desc))) + (ver (package-version-join (package-desc-version pkg-desc))) + (doc (package-desc-summary pkg-desc)) + (reqs (package-desc-reqs pkg-desc)) + (extras (package-desc-extras pkg-desc))) + (package--write-description-file pkg-file name ver doc reqs extras))) ;;;; Autoload (declare-function autoload-rubric "autoload" (file &optional type feature)) @@ -1311,11 +1305,6 @@ package--archive-file-exists-p (url-http-file-exists-p (concat location file))) (file-exists-p (expand-file-name file location))))) -(declare-function epg-make-context "epg" - (&optional protocol armor textmode include-certs - cipher-algorithm - digest-algorithm - compress-algorithm)) (declare-function epg-verify-string "epg" ( context signature &optional signed-text)) (declare-function epg-context-result-for "epg" (context name)) @@ -1397,7 +1386,6 @@ package--with-response-buffer-1 url (lambda (status) (let ((b (current-buffer))) - (require 'url-handlers) (package--unless-error body (when-let* ((er (plist-get status :error))) (error "Error retrieving: %s %S" url er)) -- 2.43.0 --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-Declare-lexical-binding-in-pkg.el-files.patch Content-Transfer-Encoding: quoted-printable From 0359f04660bd23423d93f8aa9d9bce3a726d79a4 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" <contovob@HIDDEN> Date: Tue, 19 Dec 2023 19:44:43 +0100 Subject: [PATCH] Declare lexical-binding in -pkg.el files This avoids a 'has no lexical-binding directive' warning when byte-compiling generated -pkg.el files (bug#67916). * elpa-admin.el (elpaa--alist-to-plist-args): Remove. All callers updated to call package--alist-to-plist-args instead. (elpaa--write-pkg-file): Emit lexical-binding cookie on ;;;-heading. Hoist metadata destructuring for reuse. Mention new package--write-description-file in commentary. (elpaa-batch-generate-autoloads): Remove redundant call to require. --- elpa-admin.el | 56 ++++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/elpa-admin.el b/elpa-admin.el index 9cbc805ba4..2e4fcc82df 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -1401,16 +1401,6 @@ elpaa--metadata (t (error "Can't find main file %s file in %s" mainfile dir))))) =20 -(defun elpaa--alist-to-plist-args (alist) - (mapcar (lambda (x) - (if (and (not (consp x)) - (or (keywordp x) - (not (symbolp x)) - (memq x '(nil t)))) - x `',x)) - (apply #'nconc - (mapcar (lambda (pair) (list (car pair) (cdr pair))) alis= t)))) - (defun elpaa--plist-args-to-alist (plist) (let (alist) (while plist @@ -1451,25 +1441,24 @@ elpaa--multi-file-package-def (elpaa--form-from-file-contents pkg-file))) =20 (defun elpaa--write-pkg-file (pkg-dir name metadata &optional revision) - (setf (alist-get :commit (nth 4 metadata)) - (or revision - ;; FIXME: Emacs-26's `vc-git-working-revision' ignores its - ;; arg and uses the `default-directory' to get the revision. - ;; Similar to the kludge in `elpaa--select-revision'. - (let ((default-directory pkg-dir)) - (vc-working-revision pkg-dir)))) - ;; FIXME: Use package-generate-description-file! - (let ((pkg-file (expand-file-name (format "%s-pkg.el" name) pkg-dir)) - (print-level nil) - (print-quoted t) - (print-length nil)) - (elpaa--temp-file pkg-file) - (write-region - (concat (format ";; Generated package description from %s.el -*- no-= byte-compile: t -*-\n" - name) - (prin1-to-string - (pcase-let ((`(,version ,desc ,requires ,extras) - (cdr metadata))) + (pcase-let ((`(,version ,desc ,requires ,extras) (cdr metadata))) + (setf (alist-get :commit extras) + (or revision + ;; FIXME: Emacs-26's `vc-git-working-revision' ignores its + ;; arg and uses the `default-directory' to get the revision. + ;; Similar to the kludge in `elpaa--select-revision'. + (let ((default-directory pkg-dir)) + (vc-working-revision pkg-dir)))) + ;; FIXME: Use `package--write-description-file' (in Emacs=E2=89=A530)! + (let ((pkg-file (expand-file-name (format "%s-pkg.el" name) pkg-dir)) + (print-level nil) + (print-quoted t) + (print-length nil)) + (elpaa--temp-file pkg-file) + (write-region + (concat (format ";;; Generated package description from %s.el" name) + " -*- no-byte-compile: t; lexical-binding: t -*-\n" + (prin1-to-string (nconc (list 'define-package (format "%s" name) ;It's been a string, historicall= y :-( @@ -1482,10 +1471,10 @@ elpaa--write-pkg-file (list (car elt) (package-version-join (cadr elt)))) requires))) - (elpaa--alist-to-plist-args extras)))) - "\n") - nil - pkg-file))) + (package--alist-to-plist-args extras))) + "\n") + nil + pkg-file)))) =20 (defun elpaa--write-plain-readme (pkg-dir pkg-spec) "Render a plain text readme from PKG-SPEC in PKG-DIR. @@ -2904,7 +2893,6 @@ elpaa-batch-generate-autoloads (pkgname (file-name-nondirectory (directory-file-name dir))) (pkg-spec (elpaa--get-package-spec pkgname nil 'guess)) (lisp-dir (elpaa--spec-get pkg-spec :lisp-dir))) - (require 'package) (if (null lisp-dir) (progn (cl-assert (equal alf (format "%s%s-autoloads.el" --=20 2.43.0 --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#67916
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 19 Dec 2023 21:49:50 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 19 16:49:50 2023 Received: from localhost ([127.0.0.1]:37515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rFhyI-0005TA-3O for submit <at> debbugs.gnu.org; Tue, 19 Dec 2023 16:49:50 -0500 Received: from lists.gnu.org ([2001:470:142::17]:57642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <contovob@HIDDEN>) id 1rFhyE-0005Su-MU for submit <at> debbugs.gnu.org; Tue, 19 Dec 2023 16:49:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <contovob@HIDDEN>) id 1rFhy5-0003pn-Bz for bug-gnu-emacs@HIDDEN; Tue, 19 Dec 2023 16:49:37 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <contovob@HIDDEN>) id 1rFhxz-0001GZ-Je for bug-gnu-emacs@HIDDEN; Tue, 19 Dec 2023 16:49:36 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40c6e2a47f6so52398875e9.0 for <bug-gnu-emacs@HIDDEN>; Tue, 19 Dec 2023 13:49:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; t=1703022564; x=1703627364; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=sPdVKPUwFAMioucwdobrlLq1El0Vn4Ztx38/DelNT+Q=; b=d4wA66xuHAdBYTqll/AM+HfwmzdbKxPGSkd8lZjQoKlpDXk+LAWFr6Fx/ITEstpqQ5 6u6o7dCiq6LklbNEIoR9LFB+p0SppvwADrNSSTYK2n7qCif/zQKlHeGgb6+uJKnLu68D uy/QLod/seejcEGQCDQbufhFdgbmBkhO2NRDVelYuu93+IdzY4Z8epViw2d26iLMQoLg 4ejOwIc3cyAjNNzZzQ0sdLYGYtaYQ76xvzjQWCy2dScp6q/6jIkfT8boKbvqad1M82Uu 15sc9wKjy0ARYrqLvHXJdB5566csw4LPP5B9BAsJvpDBWnX3+wbMPmfcSQjcZmZleZY0 yREQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703022564; x=1703627364; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sPdVKPUwFAMioucwdobrlLq1El0Vn4Ztx38/DelNT+Q=; b=f6yi3ZOBEeWlhNRJIhcXxdwGh86FK8uPku7EewjIY1xAkyYmXPmRXm3Cti+Z4k18Bu JEFQqjv5TEaAzO7y2x1ctK0oipRjrCNHVgIVrvdiYDlHf8t9Nztn9OhgGQ+10QBzdFVA 2tjZZ88wKtfp3DfGbbShLhstlSGVoC+MARSkM6WPgg7VTmCxSZ7ydS+ScZz4Y/IYs4oY QT9OdJPN/1R0hrBazscp0cEfX8vFG3yMVxwk2rTShHU53CFhFJqdssFv/N3m9BfdULY6 tfkckKqSt1582ebzQuu9Z2a8Fc8ePSHG25qZb7LxPvRZ7eLmFD3tYLHj24vDA0dRBTBR 0HCg== X-Gm-Message-State: AOJu0Ywz9h3l410/a3ez2DP4H+j+10Eg1AV2LGcKLyjezMGUA4xiD16z Cx9raWzkFM23fmcFPkcc0Uu9iCPA1wH6bOwkinY= X-Google-Smtp-Source: AGHT+IEUz52DodPFcO7zxF6JZkUZ7wqJKsxE6Iv0WpCxtO0pOK/xy2eaVgOE/ZWhPEiGulGRI2t+Hw== X-Received: by 2002:a05:600c:22c3:b0:40c:61fe:383c with SMTP id 3-20020a05600c22c300b0040c61fe383cmr2358843wmg.198.1703022564523; Tue, 19 Dec 2023 13:49:24 -0800 (PST) Received: from localhost ([2001:620:618:5c0:2:80b3:0:42]) by smtp.gmail.com with ESMTPSA id m26-20020a05600c3b1a00b0040b2b38a1fasm4598196wms.4.2023.12.19.13.49.23 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 13:49:23 -0800 (PST) From: "Basil L. Contovounesios" <contovob@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: 30.0.50; No lexical-binding directive warning in -pkg.el files X-Debbugs-Cc: "Stefan Monnier" <monnier@HIDDEN>, "Philip Kaludercic" <philipk@HIDDEN>, "Mattias =?utf-8?Q?Engdeg=C3=A5rd=22?= <mattias.engdegard@HIDDEN> Date: Tue, 19 Dec 2023 22:49:22 +0100 Message-ID: <87msu5q2vx.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=contovob@HIDDEN; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.1 (/) Severity: minor 0. cd "$(mktemp -d)" 1. HOME=3D"${PWD}" XDG_CONFIG_HOME=3D"${PWD}/.config" emacs 2. M-x package-install RET rbit RET 3. C-x b *Compile-Log* RET In toplevel form: rbit-pkg.el:1:1: Warning: file has no =E2=80=98lexical-binding=E2=80=99 dir= ective on its first line I wasn't sure about this one: - OT1H the warning wouldn't crop up if byte-compile-file checked no-byte-compile before it checks lexical-binding, or if package--compile added -pkg.el files to the ignore list - OTOH which dialect an Elisp file is written in (and our push for having this specified everywhere by default) is generally orthogonal to whether it should be byte-compiled - OT3H -pkg.el files are arguably plain .eld files for which specifying lexical-binding makes little sense WDYT? Couple of sample patches to follow. Thanks, --=20 Basil In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.0, Xaw3d scroll bars) of 2023-12-19 built on tia Repository revision: 7c1c2519167d51931a5d17f27529c8c8358c7c61 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101009 System Description: Debian GNU/Linux trixie/sid Configured using: 'configure 'CFLAGS=3D-Og -ggdb3' -C --prefix=3D/home/blc/.local --enable-checking=3Dstructs --without-native-compilation --with-file-notification=3Dyes --with-x-toolkit=3Dlucid --with-x' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: en_IE.UTF-8 value of $XMODIFIERS: @im=3Dibus locale-coding-system: utf-8-unix Major mode: elisp-compile Minor modes in effect: tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t minibuffer-regexp-mode: t buffer-read-only: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug ert ewoc debug backtrace help-mode find-func pcase warnings compile comint ansi-osc ansi-color ring rbit-autoloads loaddefs-gen lisp-mnt radix-tree cus-edit pp cus-start cus-load icons wid-edit mm-archive message sendmail yank-media dired dired-loaddefs rfc822 mml mml-sec epa derived gnus-util text-property-search time-date mailabbrev gmm-utils mailheader mm-decode mm-bodies mm-encode mail-utils gnutls network-stream url-cache url-http url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm puny epg rfc6068 epg-config finder-inf package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar make-network-process emacs) Memory information: ((conses 16 136237 15260) (symbols 48 11969 6) (strings 32 44639 1179) (string-bytes 1 1150536) (vectors 16 21515) (vector-slots 8 263985 21000) (floats 8 39 77) (intervals 56 408 0) (buffers 992 12))
"Basil L. Contovounesios" <contovob@HIDDEN>
:monnier@HIDDEN, philipk@HIDDEN, mattias.engdegard@HIDDEN, bug-gnu-emacs@HIDDEN
.
Full text available.monnier@HIDDEN, philipk@HIDDEN, mattias.engdegard@HIDDEN, bug-gnu-emacs@HIDDEN
:bug#67916
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.