emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] `completing-read` - allow history=t, sorting improvements


From: Stefan Monnier
Subject: Re: [PATCH] `completing-read` - allow history=t, sorting improvements
Date: Mon, 19 Apr 2021 21:55:17 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> I hope that using (cdr last) will make it unnecessary to use such a hack.
>> If not, then please try and use the `category` from `md` rather than
>> `minibuffer-completing-file-name` which I consider as obsolete (tho it's
>> not marked as such yet).
> I will check.  I still believe a tiny hack is needed because of the final
> slash.

I suggest you explain why with a concise example in a comment.
As I said, I strive to eliminate such backend-specific hacks, and while
I haven't managed to eliminate them all, I find it's important to
document them well.

> And the advantage of dropping everything behind the slash is that
> accesses to files influence the position of their parent directory (if one
> considers that an advantage).

I don't really understand what you're describing, but it reminds me of
something else: for entries which aren't found in the history, we could
look for "similar" entries.  So, e.g. if you recently used many `gnus-*`
commands recently, the other `gnus-*` commands would also be bumped up
in the list.  But this probably requires much more sophisticated code
than what we have currently (e.g. computing some kind of "distance"
between strings and weighing the value of a candidate based on its
distance to the various history entries).  We could start with
a distance based on the "length of common prefix", (length
(try-completion "" (list candidate (nth i history)))) which would need
to be combined with `i` somehow.  And if we want to avoid the N²
behavior, we'll need to use something like `radix-tree`.

> Thanks for letting me know about the `minibuffer-completing-file-name`
> variable.  There is also `minibuffer-completing-symbol`. Shall we mark them
> as obsolete?

We should, but first we need to correct the places where we still use them.

> I wondered why they exist but I took them thankfully as an easy
> way to access the category.

They predate the `completion-metadata`.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]