Fix `shadow-builtin-by-install' for changes in package.el

This commit is contained in:
Gerard Vermeulen 2023-05-11 19:32:52 +02:00
parent 92c37010fc
commit 4d4cdf1314
1 changed files with 5 additions and 4 deletions

View File

@ -337,12 +337,13 @@ the contents of packages and allows to update packages to the latest version.
;; Install and require `no-littering'.
(package-install 'no-littering)
(require 'no-littering)
;; https://emacs.stackexchange.com/a/45939 answers
;; "How to shadow automatically a built-in package by installing it?"
;; Stolen from (find-function-other-window 'eglot-upgrade-eglot):
(defun shadow-builtin-by-install (pkg)
(when-let ((desc (cadr (assq pkg package-archive-contents))))
(package-install desc 'dont-select)))
(unless (bound-and-true-p package-archive-contents)
(package-refresh-contents))
(package-install (cadr (assoc pkg package-archive-contents))))
;; Shadow built-in `org' by installing `org'.
;; Note (package-reinstall 'org) deletes the shadowing `org'.
(shadow-builtin-by-install 'org)
;; Install the selected packages.
(package-install-selected-packages)))