Add new filter command to Package Menu (Bug#39903)

* lisp/emacs-lisp/package.el
(package-menu-filter-marked): New filter command.
* test/lisp/emacs-lisp/package-tests.el
(package-test-list-filter-marked): New test.
(package-menu-mode-menu):
(package-menu-mode-map): Update menu to include new filter command.

* doc/emacs/package.texi (Package Menu): Document the new command.
* etc/NEWS: Announce the new command.
This commit is contained in:
Pieter van Oostrum 2020-03-05 20:20:04 +01:00 committed by Stefan Kangas
parent e59f697cd5
commit 196bc13b7b
4 changed files with 53 additions and 0 deletions

View file

@ -413,6 +413,21 @@ Must called from within a `tar-mode' buffer."
;; No installed packages in default environment.
(should-error (package-menu-filter-by-status "installed"))))
(ert-deftest package-test-list-filter-marked ()
"Ensure package list is filtered correctly by non-empty mark."
(with-package-test ()
(let ((buf (package-list-packages)))
(revert-buffer)
(search-forward-regexp "^ +simple-single")
(package-menu-mark-install)
(package-menu-filter-marked)
(goto-char (point-min))
(should (re-search-forward "^I +simple-single" nil t))
(should (= (count-lines (point-min) (point-max)) 1))
(package-menu-mark-unmark)
;; No marked packages in default environment.
(should-error (package-menu-filter-marked)))))
(ert-deftest package-test-list-filter-by-version ()
(with-package-menu-test
(should-error (package-menu-filter-by-version "1.1" 'unknown-symbol))) )