From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#62720: 29.0.60; Not easy at all to upgrade :core packages like Eglot Date: Sat, 15 Apr 2023 18:19:31 +0000 Message-ID: <87r0sl100c.fsf@posteo.net> References: <87a5zj2vfo.fsf@gmail.com> <831qkp6o0i.fsf@gnu.org> <83wn2h5825.fsf@gnu.org> <87wn2gkhzr.fsf@posteo.net> <83cz485oxi.fsf@gnu.org> <87leiwdyff.fsf@posteo.net> <87a5zblspg.fsf@posteo.net> <83ildz4vu7.fsf@gnu.org> <87mt3bk31e.fsf@posteo.net> <83r0smg2a6.fsf@gnu.org> <87pm86pgda.fsf@posteo.net> <838retee1z.fsf@gnu.org> <87zg794ebz.fsf@posteo.net> <83mt39ct2m.fsf@gnu.org> <87r0sl2x6j.fsf@posteo.net> <83edolcqwl.fsf@gnu.org> <87cz452scu.fsf@posteo.net> <83a5z9ckxw.fsf@gnu.org> <87zg79130e.fsf@posteo.net> <837cudcaik.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26837"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62720@debbugs.gnu.org, joaotavora@gmail.com, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 15 20:20:19 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 1pnkVV-0006lG-EA for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Apr 2023 20:20:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pnkVI-0002FO-E9; Sat, 15 Apr 2023 14:20:04 -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 1pnkVH-0002F8-DG for bug-gnu-emacs@gnu.org; Sat, 15 Apr 2023 14:20:03 -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 1pnkVH-0006bL-3s for bug-gnu-emacs@gnu.org; Sat, 15 Apr 2023 14:20:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pnkVG-0000m7-Dd for bug-gnu-emacs@gnu.org; Sat, 15 Apr 2023 14:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Apr 2023 18:20: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.16815827822932 (code B ref 62720); Sat, 15 Apr 2023 18:20:02 +0000 Original-Received: (at 62720) by debbugs.gnu.org; 15 Apr 2023 18:19:42 +0000 Original-Received: from localhost ([127.0.0.1]:50098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnkUv-0000lE-N0 for submit@debbugs.gnu.org; Sat, 15 Apr 2023 14:19:42 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:45445) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnkUt-0000kw-Dq for 62720@debbugs.gnu.org; Sat, 15 Apr 2023 14:19:40 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 6F5FE24016B for <62720@debbugs.gnu.org>; Sat, 15 Apr 2023 20:19:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1681582773; bh=WbsFmuoW76jNCZJbkMP/DsJj7OKcHxz1+Jn/DKAYS4s=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=HPVDP7Tae0tXCjo05kv5yXdP0bSIpUhdQnPt10uTwf81K/4tarJTMJPOhwbuf1fae Ly7lztWwGlL3y8p/F1yOGl4IjdOFA89sHR2VFYJeGgY8B5KqOS0HifCVQBG9hGAst2 Fji2lyfTFLaZ87DSzL54KLlyOc7MHQ7PlM67Y2YYkjz0XFcj4+rZaBZRqHc1h/6sun 5f/Ff+/R6cSmuBqJ17ZDjuXa7OXr8+s5sUlMnptW+UHfO0dMIVsoDw8kF+oelzjxxn ZjW2PwvThJA61EFFU07WVyYw068ioh1gv5QJxh/dPzczniQILCe7CMkErGKsLLEStd Rb+KPnuN0xjfw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PzM6D2vQNz6tsb; Sat, 15 Apr 2023 20:19:32 +0200 (CEST) In-Reply-To: <837cudcaik.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 15 Apr 2023 20:37:07 +0300") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM 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:260066 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: joaotavora@gmail.com, monnier@iro.umontreal.ca, 62720@debbugs.gnu.org >> Date: Sat, 15 Apr 2023 17:14:41 +0000 >> >> Eli Zaretskii writes: >> >> > The user option allows those users who always want package-install to >> > upgrade core package to have what they want, easily. So I think we >> > should keep it. On master, the option could be t by default, or >> > become unnecessary if that's what happens (but I wouldn't bet on >> > that). >> >> My argument against a user option is just that the whole deal is >> something that will in practice at most affect two packages (if we >> change the behaviour in Emacs 29). Is it really worth adding a general >> option for this very specific situation? > > I think we should count users of those packages, not just the packages > themselves. Yes, I think it's worth it, because we don't know how > many of the users will want the built-in packages to be included in an > update. OK, see below. >> > "Return non-nil if PACKAGE if the built-in version is used." >> > >> > See those two "if"s? And even if I replace the second "if" with "is", >> > the sentence doesn't make sense. >> >> Right, how does >> >> "Return non-nil if the built-in version of PACKAGE is used." >> >> sound? > > I think we should explain what does "the built-in version of PACKAGE > is used" mean, in the context in which this predicate is used. Maybe > say something like > > Return non-nil if the built-in version of PACKAGE is used. > If the built-in version of PACKAGE is used and PACKAGE is > also available for installation from an archive, it is an > indication that PACKAGE was never upgraded to any newer > version from the archive. Sounds good to me. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Allow-upgrading-built-in-packages-with-package-insta.patch >From dae52770fa50bb68a4fdd0983de7811e427733a5 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 13 Apr 2023 20:13:59 +0200 Subject: [PATCH] Allow upgrading built-in packages with 'package-install' * etc/NEWS: Mention the change * lisp/emacs-lisp/package.el (package--upgradable-built-in-p): Add new predicate. (package-install-upgrade-built-in): Add new user option to enable feature. (package-install): Respect new user option. --- etc/NEWS | 5 ++++ lisp/emacs-lisp/package.el | 47 +++++++++++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 84dbb94a71a..a7834cd0d2b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1876,6 +1876,11 @@ package maintainers. By customizing this user option you can specify specific packages to install. +--- +*** New user option 'package-install-upgrade-built-in'. +When enabled, 'package-install' can be used to install +newer versions of built-in packages. + ** Emacs Sessions (Desktop) +++ diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index f92afe56b76..c0cc7bebeb2 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -797,6 +797,21 @@ package-built-in-p (require 'finder-inf nil t) ; For `package--builtins'. (assq package package--builtins)))))) +(defun package--active-built-in-p (package) + "Return non-nil if PACKAGE if the built-in version is used. +If the built-in version of PACKAGE is used and PACKAGE is +also available for installation from an archive, it is an +indication that PACKAGE was never upgraded to any newer +version from the archive." + (and (not (assq (cond + ((package-desc-p package) + (package-desc-name package)) + ((stringp package) (intern package)) + ((symbolp package) package) + ((error "Unknown package format: %S" package))) + (package--alist))) + (package-built-in-p package))) + (defun package--autoloads-file-name (pkg-desc) "Return the absolute name of the autoloads file, sans extension. PKG-DESC is a `package-desc' object." @@ -2182,12 +2197,18 @@ package--archives-initialize (unless package-archive-contents (package-refresh-contents))) +(defcustom package-install-upgrade-built-in nil + "Non-nil means that built-in packages can be upgraded via a package archive. +If disabled, then `package-install' will not suggest to replace a +built-in package with a version from a package archive." + :type 'boolean + :version "29.1") + ;;;###autoload (defun package-install (pkg &optional dont-select) "Install the package PKG. PKG can be a `package-desc' or a symbol naming one of the -available packages in an archive in `package-archives'. When -called interactively, prompt for the package name. +available packages in an archive in `package-archives'. Mark the installed package as selected by adding it to `package-selected-packages'. @@ -2197,7 +2218,11 @@ package-install `package-selected-packages'. If PKG is a `package-desc' and it is already installed, don't try -to install it but still mark it as selected." +to install it but still mark it as selected. + +If the command is invoked with a prefix argument, the upgrading +of built-in packages will be possible, as if +`package-install-upgrade-built-in' had been enabled." (interactive (progn ;; Initialize the package system to get the list of package @@ -2205,11 +2230,14 @@ package-install (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)) + (mapcan + (lambda (elt) + (and (or (and (or current-prefix-arg + package-install-upgrade-built-in) + (package--active-built-in-p (car elt))) + (not (package-installed-p (car elt)))) + (list (symbol-name (car elt))))) + package-archive-contents) nil t)) nil))) (package--archives-initialize) @@ -2220,6 +2248,9 @@ package-install (unless (or dont-select (package--user-selected-p name)) (package--save-selected-packages (cons name package-selected-packages))) + (when (and (or current-prefix-arg package-install-upgrade-built-in) + (package--active-built-in-p pkg)) + (setq pkg (or (cadr (assq name package-archive-contents)) pkg))) (if-let* ((transaction (if (package-desc-p pkg) (unless (package-installed-p pkg) -- 2.30.2 --=-=-= Content-Type: text/plain -- Philip Kaludercic --=-=-=--