diff options
author | Federico Tedin <federicotedin@gmail.com> | 2019-09-26 19:18:58 +0200 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2019-10-08 19:24:12 +0200 |
commit | f96b8fd27c382a941c52c2938544b9b0e3a2fb0e (patch) | |
tree | 22708a866bce395e64ce5c883ac349e415dc2570 /test | |
parent | ba57f1a4273cabb53cbae86ad34b0a4bf01e1513 (diff) | |
download | emacs-f96b8fd27c382a941c52c2938544b9b0e3a2fb0e.tar.gz |
Filter packages by name in list-packages. (Bug#36981)
* lisp/emacs-lisp/package.el (package-menu-filter-by-name): New
function to filter packages by name.
(package-menu-clear-filter): New function to clear applied filters.
(package-menu-filter-by-keyword): Rename function from
package-menu-filter.
(package-menu--generate): Don't change 'q' binding anymore.
(package-menu-mode-map): Bind '/ n' to package-menu-filter-by-name, '/
k' to package-menu-filter-by-keyword and '/ /' to
package-menu-clear-filter.
(package-menu-mode-menu): Update menu entries for the three functions.
* test/lisp/emacs-lisp/package-tests.el (package-test-list-filter-by-name)
(package-test-list-clear-filter): New tests.
* doc/emacs/package.texi: Document usage of
package-menu-filter-by-name, package-menu-clear-filter and update
reference to package-menu-filter-by-keyword.
* etc/NEWS: Announce changes.
Diffstat (limited to 'test')
-rw-r--r-- | test/lisp/emacs-lisp/package-tests.el | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 0edb81d6a11..8670e6f3fac 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -365,6 +365,28 @@ Must called from within a `tar-mode' buffer." (should-not (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+\\(available\\|new\\)" nil t)) (kill-buffer buf)))) +(ert-deftest package-test-list-filter-by-name () + "Ensure package list is filtered correctly by package name." + (with-package-test () + (let ((buf (package-list-packages))) + (package-menu-filter-by-name "tetris") + (goto-char (point-min)) + (should (re-search-forward "^\\s-+tetris" nil t)) + (should (= (count-lines (point-min) (point-max)) 1)) + (kill-buffer buf)))) + +(ert-deftest package-test-list-clear-filter () + "Ensure package list filter is cleared correctly." + (with-package-test () + (let ((buf (package-list-packages))) + (let ((num-packages (count-lines (point-min) (point-max)))) + (should (> num-packages 1)) + (package-menu-filter-by-name "tetris") + (should (= (count-lines (point-min) (point-max)) 1)) + (package-menu-clear-filter) + (should (= (count-lines (point-min) (point-max)) num-packages))) + (kill-buffer buf)))) + (ert-deftest package-test-update-archives () "Test updating package archives." (with-package-test () |