]> git.eshelyaron.com Git - emacs.git/commitdiff
Make `/ a' in *Package* filter by name
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 13 Jun 2022 12:20:22 +0000 (14:20 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 13 Jun 2022 12:20:22 +0000 (14:20 +0200)
* lisp/emacs-lisp/package.el (package-menu-filter-by-archive):
Filter by package name instead of by regexp, so that if the user
types "gnu", they won't get "nongnu", too (bug#55919).

etc/NEWS
lisp/emacs-lisp/package.el

index 6f00a51a7085af9bfc9db150ad964f93ec346dc6..5df7713aeaa8929e5339db418563569f29e81fdb 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -151,6 +151,9 @@ of 'user-emacs-directory'.
 \f
 * Incompatible changes in Emacs 29.1
 
+---
+** '/ a' in *Packages* now limits by package name(s) instead of regexp.
+
 +++
 ** Setting the goal columns now also affects '<prior>' and '<next>'.
 Previously, 'C-x C-n' only affected 'next-line' and 'previous-line',
index 48551f59b43e02989192c920912cc24be9cb6dd4..9aaeb052d0dec97a33393fa9757a4995982a7b6c 100644 (file)
@@ -3963,16 +3963,14 @@ packages."
                       (mapcar #'car package-archives)))
                package-menu-mode)
   (package--ensure-package-menu-mode)
-  (let ((re (if (listp archive)
-                (regexp-opt archive)
-              archive)))
-    (package-menu--filter-by (lambda (pkg-desc)
-                        (let ((pkg-archive (package-desc-archive pkg-desc)))
-                          (and pkg-archive
-                               (string-match-p re pkg-archive))))
-                      (concat "archive:" (if (listp archive)
-                                             (string-join archive ",")
-                                           archive)))))
+  (let ((archives (ensure-list archive)))
+    (package-menu--filter-by
+     (lambda (pkg-desc)
+       (let ((pkg-archive (package-desc-archive pkg-desc)))
+         (or (null archives)
+             (and pkg-archive
+                  (member pkg-archive archives)))))
+     (concat "archive:" (string-join archives ",")))))
 
 (defun package-menu-filter-by-description (description)
   "Filter the \"*Packages*\" buffer by DESCRIPTION regexp.