Subject: bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)

From: Juri Linkov <[email-masked]>
Date: Mon, 02 Dec 2019 00:38:22 +0200

>> The problem why this patch is not installed is the need to decide
>> in what order to sort these commands.  The patch sorts alphabetically,
>> but maybe better to sort by command usage frequency, or somesuch.
>
> One possibility would be to install it and improve the ordering later.

I agree.

> BTW, do we have a mechanism for sorting by command frequency?

One possibility is to use the minibuffer history to sort by the number
of occurrences of each history element, but this method doesn't work
when history-delete-duplicates is customized to non-nil, so there are
no duplicates in the history.

Although I noticed that icomplete.el often proposes the most
relevant elements first, but I never investigated how it does this,
maybe by frequency?