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

From: Federico Tedin <[email-masked]>
Date: Wed, 18 Sep 2019 18:38:39 +0200

Hi Stefan, thanks for your input.

> 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 think the "/" prefix keybindings are a good idea; however I'm not sure
if it's OK to change an already existing keybinding. But on the other
hand this is a really minor thing so I imagine it's not that much of a
problem. The new names you chose for the commands also make more sense
than the current ones, I don't have a problem with updating them.

> 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.

Didn't know about that command, looks really useful. The only problem I
can think of implementing search that way is that it would stop being
similar to `package-menu-filter', in the sense that it currently only
shows packages that have matched the search, instead of jumping between
packages that match. On the other hand, the way I've implemented the
search is really primitive, so I guess using isearch would actually make
it much more powerful.

> 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.

Nice! This is the first command in Emacs that I've used that has
incremental search.  For this patch though I would like not to modify
package-menu-filter and just stick to adding package-menu-search. For
package-menu-search I like more the idea of making the command be just a
regular filter (like it is now) or have it use isearch, like you
suggested.

- Federico