From 87db61a6e290b7a33be484333c5f7f5146a7c2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kryger?= Date: Tue, 26 Nov 2024 17:38:17 +0000 Subject: [PATCH] [try] use package-transaction for elpa enforcment --- modules/init-lib.el | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/modules/init-lib.el b/modules/init-lib.el index 1d51a26f..d4cb4cc4 100644 --- a/modules/init-lib.el +++ b/modules/init-lib.el @@ -136,34 +136,10 @@ see Info node `(emacs) Package Installation'." (use-package-pin-package package ,archive-name) (condition-case-unless-debug err (let ((package-install-upgrade-built-in t) - ;; Ensure the newly installed package is in `load-path' - (with-load-path - (lambda (orig-fun &rest args) - (let ((pkg-dir (expand-file-name - (package-desc-full-name archive-desc) - package-user-dir))) - (if (or (member (file-name-as-directory pkg-dir) load-path) - (member (directory-file-name pkg-dir) load-path)) - (apply orig-fun args) - (let ((load-path (cons pkg-dir load-path))) - (apply orig-fun args))))))) - (unwind-protect - (progn - ;; `packgage-activate-1' calls - ;; `package--reload-previously-loaded' and then - ;; adds the newly installed package directory to - ;; `load-path'. This however may be not sufficient - ;; when some files `requires' files from the - ;; package. Ensure the new files are visible for - ;; the latter call, and allow the original - ;; `load-path' to be updated by the former. - (advice-add 'package--reload-previously-loaded - :around - with-load-path) - (package-install-from-archive archive-desc) - t) - (advice-remove 'package--reload-previously-loaded - with-load-path))) + (transaction (package-compute-transaction (list archive-desc) + (package-desc-reqs pkg)))) + (package-download-transaction transaction) + (package--quickstart-maybe-refresh)) (error (display-warning 'use-package (format "Failed to force ELPA installation %s: %s"