[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master da7dbfd: Make package-menu-filter-by-status work as documented

From: Lars Ingebrigtsen
Subject: master da7dbfd: Make package-menu-filter-by-status work as documented
Date: Sat, 10 Jul 2021 12:54:38 -0400 (EDT)

branch: master
commit da7dbfdf6858c4644a8d082639edd8a532e47c42
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make package-menu-filter-by-status work as documented
    * lisp/emacs-lisp/package.el (package-menu-filter-by-status): Work
    as documented (bug#49474).
 etc/NEWS                   |  8 ++++++++
 lisp/emacs-lisp/package.el | 11 ++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index da5524a..923cfcc 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1493,6 +1493,14 @@ This is a slightly deeper copy than the previous 
 ** 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 a0f1ab0..6bbd4c9 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -3954,9 +3954,14 @@ packages."
   (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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]