Subject: bug#36981: 26.2; request: add searching by package name to list-packages

From: Stefan Kangas <[email-masked]>
Date: Mon, 16 Sep 2019 02:29:49 +0200

Federico Tedin <[email-masked]> writes:

> ndame <[email-masked]> writes:
>
> > When installing a package from list-packages it's often
> > inconvenient to find a package which has a string which occurs
> > many times in the packages buffer. (e.g. in the descriptions).
> >
> > The package buffer has f for filtering, but it filters only for
> > package keywords, not names.
> >
> > Add a new command s for search which searches (or filters) the
> > package list by a substring match on the package name.
>
> I've implemented this feature using the "s" key as you suggested. I'm
> attaching a patch with my changes.

Thanks for working on this.

My first observation is that the search you have implemented works
very much like the package-menu-filter command bound to "f".

Maybe it would be better to put all the filtering commands on "/", and
use something like the following key bindings:

"/ n" - package-menu-search  [from "s"]
"/ k" - package-menu-filter  [from "f"]

And add the new command and key binding:

"/ /" - package-menu-clear-filter

This would be more in line with filtering in ibuffer, bookmark-bmenu,
and others.  Later, we could add more filters (for example to filter
by status, archive, time since update, etc.).  But then we probably
want to rename as follows:

package-menu-search => package-menu-filter-by-name
package-menu-filter => package-menu-filter-by-keyword

Also, this would free up the "s" key for a sorting command, which is
in line with the key binding in e.g. dired.

I also have some other, related ideas:

1. How about implementing an option to search only the package names
using isearch?  Compare to dired-isearch-filenames.

2. How about making the filtering for both package-menu-search and
package-menu-filter interactive -- that is, that the commands shows
the results as you type keys? One could look at bookmark-bmenu-search
for inspiration.

Best regards,
Stefan Kangas