Merge from origin/emacs-29

028f110273 Fix quoting of font-family in 'hfy-family'
4cb8a850b0 ; Tweak doc/misc/eglot.texi
d5d4959ed7 Document how to construct JSONRPC arrays in Eglot manual
078cf512ee * test/infra/Dockerfile.emba: Use debian:bullseye.
61adb44318 * configure.ac: Fix native comp compatibility check (bug#...
d814c249f4 * test/infra/Dockerfile.emba: Install clangd.
27edd7f88c Remove 'package-vc--query-spec'
39fea11551 Do not store :lisp-dir in package descriptors
168165178f Use 'package-vc-selected-packages' to store package specs
This commit is contained in:
Stefan Kangas 2023-03-20 06:30:30 +01:00
commit c194a31fc4
6 changed files with 55 additions and 79 deletions

View file

@ -48,7 +48,6 @@
;;; Code:
(eval-when-compile (require 'rx))
(eval-when-compile (require 'inline))
(eval-when-compile (require 'map))
(eval-when-compile (require 'cl-lib))
(require 'package)
@ -139,7 +138,6 @@ the `clone' function."
(package-desc-create :name name :kind 'vc))
spec)))))))
;;;###autoload
(defcustom package-vc-selected-packages '()
"List of packages that must be installed.
Each member of the list is of the form (NAME . SPEC), where NAME
@ -174,13 +172,9 @@ is a symbol designating the package and SPEC is one of:
All other keys are ignored.
This user option differs from `package-selected-packages' in that
it is meant to be specified manually. If you want to install all
the packages in the list, you cal also use
`package-vc-install-selected-packages'.
Note that this option will not override an existing source
package installation or revert the checked out revision."
This user option will be automatically updated to store package
specifications for packages that are not specified in any
archive."
:type '(alist :tag "List of packages you want to be installed"
:key-type (symbol :tag "Package")
:value-type
@ -191,10 +185,6 @@ package installation or revert the checked out revision."
(:lisp-dir string)
(:main-file string)
(:vc-backend symbol)))))
:initialize #'custom-initialize-default
:set (lambda (sym val)
(custom-set-default sym val)
(package-vc-install-selected-packages))
:version "29.1")
(defvar package-vc--archive-spec-alist nil
@ -224,19 +214,17 @@ All other values are ignored.")
The optional argument NAME can be used to override the default
name for PKG-DESC."
(alist-get
(or name (package-desc-name pkg-desc))
(if (package-desc-archive pkg-desc)
(setq name (or name (package-desc-name pkg-desc)))
(if (and (package-desc-archive pkg-desc)
(not (alist-get name package-vc-selected-packages
nil nil #'string=)))
(alist-get (intern (package-desc-archive pkg-desc))
package-vc--archive-spec-alist)
(apply #'append (mapcar #'cdr package-vc--archive-spec-alist)))
nil nil #'string=))
(define-inline package-vc--query-spec (pkg-desc prop)
"Query the property PROP for the package specification of PKG-DESC.
If no package specification can be determined, the function will
return nil."
(inline-letevals (pkg-desc prop)
(inline-quote (plist-get (package-vc--desc->spec ,pkg-desc) ,prop))))
;; Consult both our local list of package specifications, as well
;; as the lists provided by the archives.
(apply #'append (cons package-vc-selected-packages
(mapcar #'cdr package-vc--archive-spec-alist))))
'() nil #'string=))
(defun package-vc--read-archive-data (archive)
"Update `package-vc--archive-spec-alist' for ARCHIVE.
@ -309,12 +297,11 @@ asynchronously."
(directory (file-name-concat
(or (package-desc-dir pkg-desc)
(expand-file-name name package-user-dir))
(and-let* ((extras (package-desc-extras pkg-desc)))
(alist-get :lisp-dir extras))))
(file (or (plist-get pkg-spec :main-file)
(expand-file-name
(concat name ".el")
directory))))
(plist-get pkg-spec :lisp-dir)))
(file (expand-file-name
(or (plist-get pkg-spec :main-file)
(concat name ".el"))
directory)))
(if (file-exists-p file) file
;; The following heuristic is only necessary when fetching a
;; repository with URL that would break the above assumptions.
@ -495,12 +482,12 @@ documentation and marking the package as installed."
missing)))
(let ((default-directory (file-name-as-directory pkg-dir))
(pkg-file (expand-file-name (package--description-file pkg-dir) pkg-dir)))
(pkg-file (expand-file-name (package--description-file pkg-dir) pkg-dir))
(pkg-spec (package-vc--desc->spec pkg-desc)))
;; Generate autoloads
(let* ((name (package-desc-name pkg-desc))
(auto-name (format "%s-autoloads.el" name))
(extras (package-desc-extras pkg-desc))
(lisp-dir (alist-get :lisp-dir extras)))
(lisp-dir (plist-get pkg-spec :lisp-dir)))
(package-generate-autoloads
name (file-name-concat pkg-dir lisp-dir))
(when lisp-dir
@ -520,8 +507,7 @@ documentation and marking the package as installed."
(package-vc--generate-description-file pkg-desc pkg-file)
;; Detect a manual
(when-let ((pkg-spec (package-vc--desc->spec pkg-desc))
((executable-find "install-info")))
(when (executable-find "install-info")
(dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
(package-vc--build-documentation pkg-desc doc-file))))
@ -584,7 +570,6 @@ attribute in PKG-SPEC."
(unless (file-exists-p dir)
(make-directory (file-name-directory dir) t)
(let ((backend (or (plist-get pkg-spec :vc-backend)
(package-vc--query-spec pkg-desc :vc-backend)
(package-vc--guess-backend url)
(plist-get (alist-get (package-desc-archive pkg-desc)
package-vc--archive-data-alist
@ -659,9 +644,14 @@ abort installation?" name))
;; file system or between installations.
(throw 'done (setq lisp-dir name)))))
(when lisp-dir
(push (cons :lisp-dir lisp-dir)
(package-desc-extras pkg-desc)))
;; Ensure we have a copy of the package specification
(unless (equal (alist-get name (mapcar #'cdr package-vc--archive-spec-alist)) pkg-spec)
(customize-save-variable
'package-vc-selected-packages
(cons (cons name pkg-spec)
(seq-remove (lambda (spec) (string= name (car spec)))
package-vc-selected-packages))))
(package-vc--unpack-1 pkg-desc pkg-dir)))
(defun package-vc--read-package-name (prompt &optional allow-url installed)