Consider built-in packages to be installed
* lisp/emacs-lisp/package.el (package-installed-p): Check for built-in packages before initialization. (bug#56877).
This commit is contained in:
parent
6fd1fb8a68
commit
50a192795a
2 changed files with 19 additions and 1 deletions
|
@ -2085,7 +2085,10 @@ If PACKAGE is a `package-desc' object, MIN-VERSION is ignored."
|
|||
package-activated-list)
|
||||
;; We used the quickstart: make it possible to use package-installed-p
|
||||
;; even before package is fully initialized.
|
||||
(memq package package-activated-list))
|
||||
(or
|
||||
(memq package package-activated-list)
|
||||
;; Also check built-in packages.
|
||||
(package-built-in-p package min-version)))
|
||||
(t
|
||||
(or
|
||||
(let ((pkg-descs (cdr (assq package (package--alist)))))
|
||||
|
|
|
@ -638,6 +638,21 @@ but with a different end of line convention (bug#48137)."
|
|||
(package-refresh-contents)
|
||||
(should (equal (length package-archive-contents) 2)))))
|
||||
|
||||
(ert-deftest package-test-package-installed-p ()
|
||||
"Test package-installed-p before and after package initialization."
|
||||
(with-package-test ()
|
||||
;; Verify that `package-installed-p' evaluates true for a built-in
|
||||
;; package, in this case `project', before package initialization.
|
||||
(should (not package--initialized))
|
||||
(should (package-installed-p 'project nil))
|
||||
(should (not (package-installed-p 'imaginary-package nil)))
|
||||
|
||||
;; The results don't change after package initialization.
|
||||
(package-initialize)
|
||||
(should package--initialized)
|
||||
(should (package-installed-p 'project nil))
|
||||
(should (not (package-installed-p 'imaginary-package nil)))))
|
||||
|
||||
(ert-deftest package-test-describe-package ()
|
||||
"Test displaying help for a package."
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue