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#71356: use-package doesn't load org from elpa Date: Mon, 10 Jun 2024 15:40:58 +0000 Message-ID: <877cew24c5.fsf@posteo.net> References: <86plsvk57o.fsf@gnu.org> <86ed9aip6z.fsf@gnu.org> <87ed9abnqn.fsf@posteo.net> <868qziifzd.fsf@gnu.org> <87msnt1gkf.fsf@posteo.net> <86y17d7zzm.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="16077"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71356@debbugs.gnu.org, Andrea Corallo , paaguti@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 10 17:56:25 2024 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 1sGhNg-0003q4-5I for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Jun 2024 17:56:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sGhN7-0004m6-MJ; Mon, 10 Jun 2024 11:55:49 -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 1sGhN4-0004lX-8o for bug-gnu-emacs@gnu.org; Mon, 10 Jun 2024 11:55:46 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sGhN4-0006ae-0h for bug-gnu-emacs@gnu.org; Mon, 10 Jun 2024 11:55:46 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sGhNL-0000Ci-01 for bug-gnu-emacs@gnu.org; Mon, 10 Jun 2024 11:56:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Jun 2024 15:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71356 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71356-submit@debbugs.gnu.org id=B71356.1718034919670 (code B ref 71356); Mon, 10 Jun 2024 15:56:02 +0000 Original-Received: (at 71356) by debbugs.gnu.org; 10 Jun 2024 15:55:19 +0000 Original-Received: from localhost ([127.0.0.1]:43414 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sGhMc-0000Ai-T4 for submit@debbugs.gnu.org; Mon, 10 Jun 2024 11:55:19 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:57887) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sGh99-0007yI-Fk for 71356@debbugs.gnu.org; Mon, 10 Jun 2024 11:41:24 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 8C70E240101 for <71356@debbugs.gnu.org>; Mon, 10 Jun 2024 17:41:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1718034060; bh=TbYn/6EFLLrJNsZ8BG3ExuQP1zEsVOSjVHBdWfep+9I=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=npESTtRQQwjOLAyz15Um3L6SKqke23GRxI9xTQ/HIWRqoRSwEYvj9J/VofhXEs9dn ffxT0TONmXwaua1zUcadj+HrNCVeswzJmDdek+BBmNBgQXdOo+f1GLlBlgJ1g2B3l9 3Ga+OQWZiRxCM9dJweN2ajpydtzyIa9m4OuqB1O6Wq3zs364i3+6Rwa+hybd+VU23X cmpnkNWAlUbY//Xuko9AD+MwUHFiZABQimnzUV+EDN/XvJvV/dXYSk3QhMbfuEgJjq YGr0kOQP+RmN+pJX8+Ro/B8Lv36il3Z2MlBNSYoY8fHfo3Q8Qf5C6P3eGrhlkqgdyW uq07uYPz1Zrcw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VybcW4YLXz9rxD; Mon, 10 Jun 2024 17:40:59 +0200 (CEST) In-Reply-To: <86y17d7zzm.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 10 Jun 2024 15:18:21 +0300") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt 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:287048 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Andrea Corallo >> Cc: Eli Zaretskii , paaguti@gmail.com, 71356@debbugs.gnu.org >> Date: Mon, 10 Jun 2024 04:17:21 -0400 >> >> Philip Kaludercic writes: >> >> > Eli Zaretskii writes: >> > >> >>> From: Philip Kaludercic >> >>> Cc: Pedro Andres Aranda Gutierrez , acorallo@gnu.org, >> >>> 71356@debbugs.gnu.org >> >>> Date: Thu, 06 Jun 2024 06:15:44 +0000 >> >>> >> >>> Sorry for the delayed response; I don't think that has to be expected. >> >>> While use-package can utilise package.el for package management, my >> >>> impression is that it is at liberty to be more flexible/declarative. >> >> >> >> Doesn't use-package utilize package.el already? >> >> >> >> If not, how does it handle installation and upgrades? by its own code? >> > >> > By default it uses package.el, but there is an option to change it. >> > >> >>> > Do you have package-install-upgrade-built-in set non-nil? If not, can >> >>> > you set it non-nil and try the recipe again? >> >>> >> >>> I have tried it out myself, and it doesn't appear to do anything. The >> >>> issue looks like that `package-installed-p' doesn't respect >> >>> package-install-upgrade-built-in or :pin. >> >> >> >> We should fix that, I think. If package-install-upgrade-built-in is >> >> non-nil, use-package should upgrade built-in packages. >> >> >> >>> > As for a feature request: what exactly is the feature requested here? >> >>> > Are you saying that use-package should automatically upgrade built-in >> >>> > packages? If so, I don't think this will fly, since it would mean >> >>> > inconsistencies with package-install. >> >>> >> >>> IIUC the feature would be that if a use-package form has a >> >>> >> >>> :pin gnu >> >>> >> >>> argument, then this is an indication that we want to install the package >> >>> from GNU ELPA, disregarding the fact that Emacs already has a built-in >> >>> version of the same package. Sort of a package-local version of >> >>> `package-install-upgrade-built-in'. >> >> >> >> I'm not sure. People tend to copy/paste recipes from the Internet >> >> without really understanding what they do. I think a simple :pin >> >> should not be sufficient, we need some specialized keyword (in >> >> addition to supporting package-install-upgrade-built-in). >> > >> > To me :pin would make perfect sense, as it explicitly expresses what >> > archive we want to follow for package upgrades. >> >> +1, also use-package interface is very declarative and I'm not sure >> having it influenced by a dynamic var would match user expected >> behavior. > > If you prefer, we could add a new :foo keyword to mean this. But > unconditionally changing what :pin means in these cases is out of the > question. We wouldn't change what :pin means directly, but just have package-install respect `package-pinned-packages'. It seems that all we have to change is this: --=-=-= Content-Type: text/plain Content-Disposition: inline diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index fda855d2143..562dc5dbca3 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2173,7 +2173,8 @@ package-installed-p (version-list-<= min-version (package-desc-version (car pkg-descs))))) ;; Also check built-in packages. - (package-built-in-p package min-version))))) + (and (not (package-install-upgrade-built-in-p package)) + (package-built-in-p package min-version)))))) (defun package-download-transaction (packages) "Download and install all the packages in PACKAGES. @@ -2197,6 +2198,11 @@ package-install-upgrade-built-in :type 'boolean :version "29.1") +(defun package-install-upgrade-built-in-p (pkg) + "Return non-nil if PKG should be upgraded." + (or (assq pkg package-pinned-packages) + package-install-upgrade-built-in)) + ;;;###autoload (defun package-install (pkg &optional dont-select) "Install the package PKG. @@ -2226,7 +2232,7 @@ package-install (mapcan (lambda (elt) (and (or (and (or current-prefix-arg - package-install-upgrade-built-in) + (package-install-upgrade-built-in-p elt)) (package--active-built-in-p (car elt))) (not (package-installed-p (car elt)))) (list (symbol-name (car elt))))) @@ -2241,7 +2247,7 @@ 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) + (when (and (or current-prefix-arg (package-install-upgrade-built-in-p name)) (package--active-built-in-p pkg)) (setq pkg (or (cadr (assq name package-archive-contents)) pkg))) (if-let* ((transaction --=-=-= Content-Type: text/plain (not thoroughly tested, just a sketch that makes (use-package org :ensure t :pin gnu) work) -- Philip Kaludercic on peregrine --=-=-=--