From: Andrea Corallo <acorallo@gnu.org>
To: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
Cc: 71356@debbugs.gnu.org
Subject: bug#71356: use-package doesn't load org from elpa
Date: Tue, 04 Jun 2024 17:44:37 -0400 [thread overview]
Message-ID: <yp1bk4go01m.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <CAO48Bk87Ffg3TagV=_dHboOBqpkY0xV4F4XWUhRrRZzOfd+RRg@mail.gmail.com> (Pedro Andres Aranda Gutierrez's message of "Tue, 4 Jun 2024 08:26:20 +0200")
[-- Attachment #1: Type: text/plain, Size: 718 bytes --]
tags 71356 patch
thanks
Pedro Andres Aranda Gutierrez <paaguti@gmail.com> 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-use-package-for-built-in-pinned-packages.patch --]
[-- Type: text/x-diff, Size: 3255 bytes --]
From 4942ef85c2db0fb7b24e87da57456be208e83605 Mon Sep 17 00:00:00 2001
From: Andrea Corallo <acorallo@gnu.org>
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
next prev parent reply other threads:[~2024-06-04 21:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 6:26 bug#71356: use-package doesn't load org from elpa Pedro Andres Aranda Gutierrez
2024-06-04 21:44 ` Andrea Corallo [this message]
2024-06-05 6:40 ` Pedro Andres Aranda Gutierrez
2024-06-05 11:18 ` Eli Zaretskii
2024-06-05 18:09 ` Andrea Corallo
2024-06-06 5:46 ` Pedro Andres Aranda Gutierrez
2024-06-06 6:02 ` Eli Zaretskii
2024-06-06 6:11 ` Pedro Andres Aranda Gutierrez
2024-06-06 9:15 ` Eli Zaretskii
2024-06-06 6:15 ` Philip Kaludercic
2024-06-06 9:21 ` Eli Zaretskii
2024-06-06 15:07 ` Pedro Andres Aranda Gutierrez
2024-06-06 15:19 ` Eli Zaretskii
2024-06-07 8:05 ` Pedro Andres Aranda Gutierrez
2024-06-10 6:02 ` Philip Kaludercic
2024-06-10 6:52 ` Pedro Andres Aranda Gutierrez
2024-06-10 8:17 ` Andrea Corallo
2024-06-10 12:18 ` Eli Zaretskii
2024-06-10 15:40 ` Philip Kaludercic
2024-06-10 16:12 ` Eli Zaretskii
2024-06-10 16:51 ` Pedro Andres Aranda Gutierrez
2024-06-10 17:46 ` Eli Zaretskii
2024-06-10 18:04 ` Philip Kaludercic
2024-06-11 5:27 ` Pedro Andres Aranda Gutierrez
2024-06-11 7:29 ` Eli Zaretskii
2024-06-11 7:53 ` Pedro Andres Aranda Gutierrez
2024-06-10 12:14 ` Eli Zaretskii
2024-11-05 6:26 ` bug#71356: Follow-up on bug#71356 Pedro A. Aranda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yp1bk4go01m.fsf@fencepost.gnu.org \
--to=acorallo@gnu.org \
--cc=71356@debbugs.gnu.org \
--cc=paaguti@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.