From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#62720: 29.0.60; Not easy at all to upgrade :core packages like Eglot Date: Wed, 12 Apr 2023 17:13:27 +0100 Message-ID: References: <87a5zj2vfo.fsf@gmail.com> <87y1mz38rl.fsf@posteo.net> <87ile2n0kn.fsf@gmail.com> <83v8i2abqi.fsf@gnu.org> <87wn2ilgx7.fsf@gmail.com> <83a5ze9uc1.fsf@gnu.org> <831qkq9rpy.fsf@gnu.org> <83pm898xb9.fsf@gnu.org> <87h6tlleg0.fsf@gmail.com> <8335558qc7.fsf@gnu.org> <83sfd5761f.fsf@gnu.org> <87zg7djrgr.fsf@gmail.com> <83o7nt73za.fsf@gnu.org> <83mt3d73c2.fsf@gnu.org> <87r0sptinq.fsf@posteo.net> <83jzyh706c.fsf@gnu.org> <875ya1tdwf.fsf@posteo.net> <83edop6sdy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22361"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 62720@debbugs.gnu.org, Philip Kaludercic , monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 12 18:14:21 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pmd6y-0005dO-O3 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 12 Apr 2023 18:14:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmd6k-0001hP-Rq; Wed, 12 Apr 2023 12:14:07 -0400 Original-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 ) id 1pmd6i-0001h4-Dm for bug-gnu-emacs@gnu.org; Wed, 12 Apr 2023 12:14:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pmd6g-0002BC-Gl for bug-gnu-emacs@gnu.org; Wed, 12 Apr 2023 12:14:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pmd6g-0000Wg-3A for bug-gnu-emacs@gnu.org; Wed, 12 Apr 2023 12:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Apr 2023 16:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62720 X-GNU-PR-Package: emacs Original-Received: via spool by 62720-submit@debbugs.gnu.org id=B62720.16813160271994 (code B ref 62720); Wed, 12 Apr 2023 16:14:02 +0000 Original-Received: (at 62720) by debbugs.gnu.org; 12 Apr 2023 16:13:47 +0000 Original-Received: from localhost ([127.0.0.1]:41536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmd6Q-0000W4-Ln for submit@debbugs.gnu.org; Wed, 12 Apr 2023 12:13:47 -0400 Original-Received: from mail-oi1-f179.google.com ([209.85.167.179]:47029) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmd6O-0000Vr-7Q for 62720@debbugs.gnu.org; Wed, 12 Apr 2023 12:13:44 -0400 Original-Received: by mail-oi1-f179.google.com with SMTP id w19so8048852oiv.13 for <62720@debbugs.gnu.org>; Wed, 12 Apr 2023 09:13:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681316018; x=1683908018; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=s2CDv+sXU/j+I7ISvwyZ+ZlpmUQeJYbiGscJSiYE2Cg=; b=YvBHip/Y6n2pBt8NuAcwZvYn6UEOKFr7NzTPP4l3OCKKZPDoTmxnDVWYTnaodtZdmu cJAWg38Xmz6/nqAxvEW2nU2mZVW2NVvNOruq27Buh3DMFxZ9BJ9xfjLEvSQPfPv5HU2y R+ckp5A52DCsmj0VK8gr7qD7BLQGI9Ff777zkL8PLfbeMvcSJQfxL2h4PKeoqffUrjgg C2zAer2JXlVVJLXfW/Vm+J3DMDhOM4OTBT8QaFz7eSXdBr5qGRD45X3RTfweiwYRhd74 Koy/eAZtzVjpMg9qyfcMqbSIyhv7dZl0qZDFLTeg08I9ognFJzo76lE7+wmt2I1H2kj4 2oHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681316018; x=1683908018; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s2CDv+sXU/j+I7ISvwyZ+ZlpmUQeJYbiGscJSiYE2Cg=; b=5ykFm+Fi6NkmE+H6km0iZC5dKvdV9efD1aE3YguHEXpbX0uzmQ2DJfOZN9xAqj8orA 7GLafZjIDhW6raO+QiszEsN5Ohv6DqLOm7DdvgcO/e7c496wpty//6xYgJFBvjmT1CYE YzN8Ds3CNXRH/6Gx2JIq7+ZXfWGeLJ/vX4zqAoQ/3vkaCk8x98bimAncPN/qqsdQvogt d3FQiRS+BU9yRjtCnP7M/XGWL9hj7gziepv12VsSLqGupUYFa7/mYmQC0YvLm4Io6Wnp gC+C8Ssg8N8Hf5fAA8GHOl3ETXsL/oHX1T2l1I5xdz8igzRgHnyOXHDG6MbdQJJZRmlm PdLQ== X-Gm-Message-State: AAQBX9d18dE83oL11vmVHQeZROXxpMOGnMXt3En2MPQGmBg0xefWjyqq SDYccGhREt7yTUi1bLx3b/gWrMkuj2ev4ayEkMY= X-Google-Smtp-Source: AKy350b6RCXn2K8dRC/PdNNCJtOH5tbOjjKhplkwkwAmw0BnJdAYGCB/YoEcjKB+rYRr2rmoBGZ3cM9IhaQkf7jU8VU= X-Received: by 2002:aca:ea83:0:b0:384:1cf9:912e with SMTP id i125-20020acaea83000000b003841cf9912emr781183oih.5.1681316018338; Wed, 12 Apr 2023 09:13:38 -0700 (PDT) In-Reply-To: <83edop6sdy.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:259778 Archived-At: On Wed, Apr 12, 2023 at 4:17=E2=80=AFPM Eli Zaretskii wrote: > The above questions and undocumented subtleties is what scares me in > installing such changes at this late stage. I'm not sure everyone > involved, yourself included, have a clear understanding of what the > modified code will do in each possible use case. That is why I very > much prefer separate code, which will then free us from the need of > considering all these subtleties, as the last year of user's > experience with this code can vouch that it does its job correctly, by > and large. Alright, I've tried my hand at making this clean separation, so that no logic of transaction or existing predicates is touched. I tried to make it as intelligible as possible perhaps overdoing the commentary and the naming, but we can always trim it. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 685f983e285..51d633131d9 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2178,6 +2178,24 @@ package--archives-initialize (unless package-archive-contents (package-refresh-contents))) +(defun package--vestal-builtins-available-for-installation () + "Return built-in packages that can but have never been updated. +The return value is a subset of `package-archive-contents', i.e. +a list ((SYM PACKAGE-DESC) ...) where SYM names such a built-in +package. For bug#62720. + +Because we reject packages that are in `package--alist', this set +is guaranteed to _not_ intersect with the subset of +`package-archive-contents', which verifies `package-installed-p'. +which, for historical reasons (and in suspicious conditions) says +that built-in packages as installed." + (let (res) + (dolist (bi package--builtins) + (when-let ((probe (and (not (assq (car bi) (package--alist))) + (assq (car bi) package-archive-contents)))) + (push probe res))) + res)) + ;;;###autoload (defun package-install (pkg &optional dont-select) "Install the package PKG. @@ -2196,19 +2214,27 @@ package-install to install it but still mark it as selected." (interactive (progn - ;; Initialize the package system to get the list of package - ;; symbols for completion. (package--archives-initialize) (list (intern (completing-read "Install package: " - (delq nil - (mapcar (lambda (elt) - (unless (package-installed-p (car elt)= ) - (symbol-name (car elt)))) - package-archive-contents)) + (append + (delq nil + (mapcar (lambda (elt) + (unless (package-installed-p (car elt= )) + (symbol-name (car elt)))) + package-archive-contents)) + (mapcar #'car + (package--vestal-builtins-available-for-installation))) nil t)) nil))) (package--archives-initialize) + ;; See docstring and code of + ;; `package--vestal-builtins-available-for-installation' to + ;; understand how this code can only kick in if indeed the user + ;; selected a such a package from the completion list. bug#62720. + (when-let ((name-and-desc + (assq pkg (package--vestal-builtins-available-for-installation)))) + (setq pkg (cadr name-and-desc))) (add-hook 'post-command-hook #'package-menu--post-refresh) (let ((name (if (package-desc-p pkg) (package-desc-name pkg)