From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#62720: 29.0.60; Not easy at all to upgrade :core packages like Eglot Date: Sat, 22 Apr 2023 03:57:03 +0300 Message-ID: <8e9bd99a-3093-3b69-8429-aa1ae6b7240d@gutov.dev> References: <87a5zj2vfo.fsf@gmail.com> <83r0sh8i1q.fsf@gnu.org> <35638c9d-e13f-fad8-5f95-ea03d65d4aa2@gmail.com> <87a5z3izst.fsf@web.de> <83v8hr7qk9.fsf@gnu.org> <83pm7z7nkc.fsf@gnu.org> <4b63ef62-5e1c-3dcf-ec7b-06b69e79133b@gutov.dev> <83o7nj7mfn.fsf@gnu.org> <556e0fbb-215e-c11d-0e8b-73e97441abbb@gutov.dev> <83pm7y6fdo.fsf@gnu.org> <47140c27-ba63-ca7b-8b9e-cc38a6f9a866@gutov.dev> <838rem636a.fsf@gnu.org> <83leil4u63.fsf@gnu.org> <8a9d0e2b-6ae2-bcdc-efd0-52a44ac862bb@gutov.dev> <83h6t94hru.fsf@gnu.org> <7676c8d2-1324-31e7-38b3-de167ecf683a@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32712"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Cc: jporterbugs@gmail.com, philipk@posteo.net, 62720@debbugs.gnu.org, monnier@iro.umontreal.ca, larsi@gnus.org, joaotavora@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 22 02:58:36 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 1pq1aE-0008Ji-En for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Apr 2023 02:58:35 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pq1Zl-0006n5-Ih; Fri, 21 Apr 2023 20:58:05 -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 1pq1Zi-0006mU-TU for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2023 20:58:02 -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 1pq1Zi-0003Pn-LM for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2023 20:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pq1Zi-0003Es-0T for bug-gnu-emacs@gnu.org; Fri, 21 Apr 2023 20:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Apr 2023 00:58:01 +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.168212504112383 (code B ref 62720); Sat, 22 Apr 2023 00:58:01 +0000 Original-Received: (at 62720) by debbugs.gnu.org; 22 Apr 2023 00:57:21 +0000 Original-Received: from localhost ([127.0.0.1]:41410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pq1Z2-0003De-H2 for submit@debbugs.gnu.org; Fri, 21 Apr 2023 20:57:20 -0400 Original-Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]:48917) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pq1Yx-0003DP-Cy for 62720@debbugs.gnu.org; Fri, 21 Apr 2023 20:57:19 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id D25CF2B06840; Fri, 21 Apr 2023 20:57:08 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 21 Apr 2023 20:57:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1682125028; x=1682128628; bh=Gqzx80o0VgJufgsBNzU7fwZ2bsqqdqL3xmO Gkz7zz8c=; b=GePvUx1zbru06xOFX2016Hz5YR5NTbH+UEj3HOF1gb3bvaE1PvG RMnounuyPkgm2cd8IOHMjEVHvJnPb987GW0G0RPeq/jKjT6ofAHb/FSNS6rbe/v2 Ee/4ScpO0HAFIkRdzLMu6QdDhMqr8RyHXNr+Hp+ix2lQSvPO5di2cWphfojsa9zc +UhmGBlrnn4xsV73zOvX2gcYni5T90ioGjcw3qym8i42VyARponK/cGB/jxJ7/cG QqmA52tLupLvWS4EDJg1ST1oMqk1H9NgdLmtto/TogbyRyQZmL50Zaitwyb4kmye gAYIwZtLEkW14rvu3DCMcnyFXTrIj5AnmyQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1682125028; x=1682128628; bh=Gqzx80o0VgJufgsBNzU7fwZ2bsqqdqL3xmO Gkz7zz8c=; b=j6dIrK+XoPkQt/BMgdIt5QdTzZIybkFNvsHQQeAFp1kNCOn8sKL smi/xKRs7i3kUyvoHG/gdKUsopwbDW9CQQUDPXwm8WApIx0lHVA/pfjsBGA3I8fA BfzdDVSWq6XEITENm4+VDzSLqG7w4mUCepauE6FAGUe7MCh+yb/Np6WvF9rjUmd/ o+XsltYwP7iGD3ZvZv2SdR24Mnt7RtZQ0+UMWjY6Ohndg619br77LWJDMAnsbQhl koO2LHcWqUTP22y56jYUdat2g2mwYdPcQRFCrZ+ApwEkaQc1dqGlCiMaJzzOn5De YJPHALptYUvy6pQ0OBGqtD6AdI0z4cJzwyA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedthedggedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffhvfevfhgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhephfeftdejleetffelhfffteefgfeggfejgfdtudeuvedttdetvdelffekvdeg udetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 21 Apr 2023 20:57:05 -0400 (EDT) Content-Language: en-US In-Reply-To: <7676c8d2-1324-31e7-38b3-de167ecf683a@gutov.dev> 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:260420 Archived-At: On 22/04/2023 02:12, Dmitry Gutov wrote: >> In interactive invocation, package-upgrade calls completing-read with >> its 4th argument non-nil, so you cannot select a package which is not >> in the collection returned by package--updateable-packages.  What I >> meant above is to allow that collection to include built-in packages >> as optional behavior.  I just tried invoking package-update for ElDoc, >> and I get "No match" after typing "eldoc" to its prompt, although >> eldoc version 1.14.0 is in the list presented by list-packages as >> "available". > > That's what I imagined: adding a new optional argument to > package--updateable-packages which would include builtins in the result. > > And only pass it when called from package-upgrade. > > Hopefully that's the kind of optional that you meant. Here's a patch which does that. The diff could be reduced (the package-update part) by binding the new option (package-install-upgrade-built-in), but I figured it's better to avoid interdependency while we're still deciding what to keep. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ffa6272dd1f..1f0a47f6b6a 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2270,17 +2270,21 @@ package-update "Update package NAME if a newer version exists." (interactive (list (completing-read - "Update package: " (package--updateable-packages) nil t))) + "Update package: " (package--updateable-packages t) nil t))) (let* ((package (if (symbolp name) name (intern name))) (pkg-desc (cadr (assq package package-alist)))) - (if (package-vc-p pkg-desc) + (if (and pkg-desc (package-vc-p pkg-desc)) (package-vc-update pkg-desc) - (package-delete pkg-desc 'force) - (package-install package 'dont-select)))) - -(defun package--updateable-packages () + (when pkg-desc + (package-delete pkg-desc 'force)) + (package-install-from-archive + (car (last (seq-sort-by #'package-desc-priority-version + #'version-list-< + (cdr (assq package package-archive-contents))))))))) + +(defun package--updateable-packages (&optional allow-builtins) ;; Initialize the package system to get the list of package ;; symbols for completion. (package--archives-initialize) @@ -2291,11 +2295,21 @@ package--updateable-packages (or (let ((available (assq (car elt) package-archive-contents))) (and available - (version-list-< - (package-desc-version (cadr elt)) - (package-desc-version (cadr available))))) - (package-vc-p (cadr (assq (car elt) package-alist))))) - package-alist))) + (or (and + allow-builtins + (not (package-desc-version (cadr elt)))) + (version-list-< + (package-desc-version (cadr elt)) + (package-desc-version (cadr available)))))) + (package-vc-p (cadr elt)))) + (if allow-builtins + (append package-alist + (mapcan + (lambda (elt) + (when (not (assq (car elt) package-alist)) + (list (list (car elt) (package--from-builtin elt))))) + package--builtins)) + package-alist)))) ;;;###autoload (defun package-update-all (&optional query)