From: Juri Linkov <juri@linkov.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, emacs-devel@gnu.org
Subject: Re: Sorting command completions by recency
Date: Wed, 17 Feb 2021 22:09:33 +0200 [thread overview]
Message-ID: <87o8gifoci.fsf@mail.linkov.net> (raw)
In-Reply-To: <jwvzh02ealh.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 17 Feb 2021 14:55:46 -0500")
>>> This code puts the recent commands at the top as well,
>>> but probably it needs to be opt-in:
>> Makes sense to me, and, yes.
>
> FWIW, the minibuffer.el code already uses this kind of sorting for the
> list of completions used in things like `icomplete` and
> `completion-cycle-threshold`.
I stole code from `completion-all-sorted-completions' used by `icomplete`,
but see no way to call it directly.
> For *Completions* the sort was kept alphabetical so far because that's
> also useful (for example in the case of M-x completion, it makes it
> easier to skip over blocs of commands sharing the same prefix).
>
> So, while I think it can be useful to sort by some kind of "guessed
> usefulness" such as presence in the history, I don't think this should
> be forced by the completion table of commands.
Maybe a new option should allow switching the sorting order.
Perhaps, it should have a form of an alist:
'(("alphabetical" . identity)
("by recency" . (lambda (commands)
(if (minibufferp)
;; Prefer recently used completions and put the default,
;; if it exists, on top.
(let ((hist (symbol-value minibuffer-history-variable)))
(sort commands
...
next prev parent reply other threads:[~2021-02-17 20:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-17 17:53 Sorting command completions by recency Juri Linkov
2021-02-17 18:33 ` Lars Ingebrigtsen
2021-02-17 19:55 ` Stefan Monnier
2021-02-17 20:03 ` Clemens
2021-02-17 20:58 ` Stefan Monnier
2021-02-18 17:34 ` Juri Linkov
2021-02-17 20:09 ` Juri Linkov [this message]
2021-02-17 22:02 ` [External] : " Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o8gifoci.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).