From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#71356: use-package doesn't load org from elpa Date: Tue, 04 Jun 2024 17:44:37 -0400 Message-ID: References: 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="33825"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 71356@debbugs.gnu.org To: Pedro Andres Aranda Gutierrez Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 04 23:46:28 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 1sEbz9-0008Zh-U4 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Jun 2024 23:46:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEbyi-0005iX-N3; Tue, 04 Jun 2024 17:46:00 -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 1sEbye-0005hN-P2 for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 17:45:57 -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 1sEbyW-0003AZ-QG for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 17:45:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sEbyk-0000DH-08 for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 17:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Jun 2024 21:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71356 X-GNU-PR-Package: emacs Original-Received: via spool by 71356-submit@debbugs.gnu.org id=B71356.1717537508705 (code B ref 71356); Tue, 04 Jun 2024 21:46:01 +0000 Original-Received: (at 71356) by debbugs.gnu.org; 4 Jun 2024 21:45:08 +0000 Original-Received: from localhost ([127.0.0.1]:53904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sEbxm-0000B2-Ks for submit@debbugs.gnu.org; Tue, 04 Jun 2024 17:45:08 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sEbxh-0000A6-Ah for 71356@debbugs.gnu.org; Tue, 04 Jun 2024 17:45:01 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEbxN-0002sY-M0; Tue, 04 Jun 2024 17:44:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=p4Z1NAzT/NAq0mr6f8GAdx4iDMxMdr4bmtPIzWDjmCg=; b=lQwdsmO06/rw7QMhSSBI 73/JOnWzyhmOGUVVo5AcwiSa7jiHoYB+s2qVZP1g+NBLl8f56cmqKDfK2W24jKwet+4yQyYGLd47T eOKP7ESqNyNGqXSVPjGFnOHwp4v3RCE2TTEmespgZbGI0n4CMKIzdUppm8zuTPnonw9JMv4ABIi/Y ZwlD03Zg8yObH+rAM+M3ofL3tT/fzmqQMZjQFnR8FiOLNSb2VEIhnmqni4pdAc0DD0GSSiAJ96OSi bD/f5lFikMe02yNFUh1+cUPBm9DVHJQV9jAucLRo8ur9Ln4OhTIrOTVKNkLgRkzp2Tq/tRG1WElxd rHVbQK2zxDhESA==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1sEbxN-0000L4-6I; Tue, 04 Jun 2024 17:44:37 -0400 In-Reply-To: (Pedro Andres Aranda Gutierrez's message of "Tue, 4 Jun 2024 08:26:20 +0200") 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:286558 Archived-At: --=-=-= Content-Type: text/plain tags 71356 patch thanks Pedro Andres Aranda Gutierrez writes: > A minimal init.el: > ----- > (package-initialize) > (package-refresh-contents) > (use-package org > :ensure t > :pin gnu) > ----- > Expected result would be C-h v org-version returning 9.7.2, but I see 9.6.15 (the builtin package) I can reproduce it. Seems the issue is in 'use-package-ensure-elpa' where we gate any installation with "(unless (package-installed-p package)". I think we should progress also if we see that the package is built-in and is actually pinned. The attached seems to do the job for me, but I'm not 100% sure it's the best/right fix so I'd appretiate someone else to have a look. Thanks Andrea --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-use-package-for-built-in-pinned-packages.patch >From 4942ef85c2db0fb7b24e87da57456be208e83605 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 4 Jun 2024 23:30:07 +0200 Subject: [PATCH] Fix use-package for built-in pinned packages * lisp/use-package/use-package-ensure.el (use-package-ensure-elpa): Always install built-in pinned packages. --- lisp/use-package/use-package-ensure.el | 47 ++++++++++++++------------ 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/lisp/use-package/use-package-ensure.el b/lisp/use-package/use-package-ensure.el index 5f75b6b59ea..a6ed980610f 100644 --- a/lisp/use-package/use-package-ensure.el +++ b/lisp/use-package/use-package-ensure.el @@ -157,28 +157,33 @@ use-package-ensure-elpa ensure))) (when package (require 'package) - (when (consp package) - (use-package-pin-package (car package) (cdr package)) - (setq package (car package))) - (unless (package-installed-p package) - (condition-case-unless-debug err - (progn - (when (assoc package (bound-and-true-p - package-pinned-packages)) - (package-read-all-archive-contents)) - (if (assoc package package-archive-contents) - (package-install package) - (package-refresh-contents) - (when (assoc package (bound-and-true-p - package-pinned-packages)) + (let* ((pinned (assoc package (bound-and-true-p + package-pinned-packages))) + (need-upgrade (and pinned (package-built-in-p package)))) + (when (consp package) + (use-package-pin-package (car package) (cdr package)) + (setq package (car package))) + (when (or (not (package-installed-p package)) need-upgrade) + (condition-case-unless-debug err + (progn + (when pinned (package-read-all-archive-contents)) - (package-install package)) - t) - (error - (display-warning 'use-package - (format "Failed to install %s: %s" - name (error-message-string err)) - :error)))))))) + (if (assoc package package-archive-contents) + (if need-upgrade + (package-upgrade package) + (package-install package)) + (package-refresh-contents) + (when pinned + (package-read-all-archive-contents)) + (if need-upgrade + (package-upgrade package) + (package-install package))) + t) + (error + (display-warning 'use-package + (format "Failed to install %s: %s" + name (error-message-string err)) + :error))))))))) ;;;###autoload (defun use-package-handler/:ensure (name _keyword ensure rest state) -- 2.34.1 --=-=-=--