From: Lars Ingebrigtsen Date: Sat, 10 Jul 2021 16:53:28 +0000 (+0200) Subject: Make package-menu-filter-by-status work as documented X-Git-Tag: emacs-28.0.90~1912 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=da7dbfdf6858c4644a8d082639edd8a532e47c42;p=emacs.git Make package-menu-filter-by-status work as documented * lisp/emacs-lisp/package.el (package-menu-filter-by-status): Work as documented (bug#49474). --- diff --git a/etc/NEWS b/etc/NEWS index da5524a5553..923cfcc4722 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1493,6 +1493,14 @@ This is a slightly deeper copy than the previous 'copy-sequence'. ** Package +--- +*** '/ s' ('package-menu-filter-by-status') changes parameter handling. +The command was documented to take a comma-separated list of statuses +to filter by, but instead it used the parameter as a regexp. The +command has been changed so that it now works as documented, and +checks statuses not as a regexp, but instead an exact match from the +comma-separated list. + +++ *** New command 'package-browse-url' and keystroke 'w'. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index a0f1ab0ed67..6bbd4c99763 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -3954,9 +3954,14 @@ packages." (package--ensure-package-menu-mode) (if (or (not status) (string-empty-p status)) (package-menu--generate t t) - (package-menu--filter-by (lambda (pkg-desc) - (string-match-p status (package-desc-status pkg-desc))) - (format "status:%s" status)))) + (let ((status-list + (if (listp status) + status + (split-string status ",")))) + (package-menu--filter-by + (lambda (pkg-desc) + (member (package-desc-status pkg-desc) status-list)) + (format "status:%s" (string-join status-list ",")))))) (defun package-menu-filter-by-version (version predicate) "Filter the \"*Packages*\" buffer by VERSION and PREDICATE.