diff options
| author | Federico Tedin | 2019-09-26 19:18:58 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2019-10-08 19:24:12 +0200 |
| commit | f96b8fd27c382a941c52c2938544b9b0e3a2fb0e (patch) | |
| tree | 22708a866bce395e64ce5c883ac349e415dc2570 /test | |
| parent | ba57f1a4273cabb53cbae86ad34b0a4bf01e1513 (diff) | |
| download | emacs-f96b8fd27c382a941c52c2938544b9b0e3a2fb0e.tar.gz emacs-f96b8fd27c382a941c52c2938544b9b0e3a2fb0e.zip | |
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." | |||
| 365 | (should-not (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+\\(available\\|new\\)" nil t)) | 365 | (should-not (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+\\(available\\|new\\)" nil t)) |
| 366 | (kill-buffer buf)))) | 366 | (kill-buffer buf)))) |
| 367 | 367 | ||
| 368 | (ert-deftest package-test-list-filter-by-name () | ||
| 369 | "Ensure package list is filtered correctly by package name." | ||
| 370 | (with-package-test () | ||
| 371 | (let ((buf (package-list-packages))) | ||
| 372 | (package-menu-filter-by-name "tetris") | ||
| 373 | (goto-char (point-min)) | ||
| 374 | (should (re-search-forward "^\\s-+tetris" nil t)) | ||
| 375 | (should (= (count-lines (point-min) (point-max)) 1)) | ||
| 376 | (kill-buffer buf)))) | ||
| 377 | |||
| 378 | (ert-deftest package-test-list-clear-filter () | ||
| 379 | "Ensure package list filter is cleared correctly." | ||
| 380 | (with-package-test () | ||
| 381 | (let ((buf (package-list-packages))) | ||
| 382 | (let ((num-packages (count-lines (point-min) (point-max)))) | ||
| 383 | (should (> num-packages 1)) | ||
| 384 | (package-menu-filter-by-name "tetris") | ||
| 385 | (should (= (count-lines (point-min) (point-max)) 1)) | ||
| 386 | (package-menu-clear-filter) | ||
| 387 | (should (= (count-lines (point-min) (point-max)) num-packages))) | ||
| 388 | (kill-buffer buf)))) | ||
| 389 | |||
| 368 | (ert-deftest package-test-update-archives () | 390 | (ert-deftest package-test-update-archives () |
| 369 | "Test updating package archives." | 391 | "Test updating package archives." |
| 370 | (with-package-test () | 392 | (with-package-test () |