From: Lars Ingebrigtsen Date: Mon, 13 Jun 2022 12:20:22 +0000 (+0200) Subject: Make `/ a' in *Package* filter by name X-Git-Tag: emacs-29.0.90~1910^2~44 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0fdd37c7fbbd0880e569d41bb5ecb9a40f099b00;p=emacs.git Make `/ a' in *Package* filter by name * 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). --- diff --git a/etc/NEWS b/etc/NEWS index 6f00a51a708..5df7713aeaa 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -151,6 +151,9 @@ of 'user-emacs-directory'. * 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 '' and ''. Previously, 'C-x C-n' only affected 'next-line' and 'previous-line', diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 48551f59b43..9aaeb052d0d 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -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.