unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Daniel Mendler <daniel@mendler.net>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] `completing-read` - allow history=t, sorting improvements
Date: Mon, 19 Apr 2021 21:55:17 -0400	[thread overview]
Message-ID: <jwvpmypraz0.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <66a96995-10ec-f466-530c-87d173cdfaba@mendler.net> (Daniel Mendler's message of "Tue, 20 Apr 2021 01:47:34 +0200")

>> 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	other threads:[~2021-04-20  1:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 18:02 [PATCH] `completing-read` - allow history=t, sorting improvements Daniel Mendler
2021-04-19 19:14 ` Stefan Monnier
2021-04-19 19:36   ` Daniel Mendler
2021-04-19 20:15     ` Stefan Monnier
2021-04-19 20:44       ` Daniel Mendler
2021-04-19 21:52         ` Stefan Monnier
2021-04-19 22:29           ` Daniel Mendler
2021-04-19 22:55             ` Stefan Monnier
2021-04-19 23:47               ` Daniel Mendler
2021-04-20  1:55                 ` Stefan Monnier [this message]

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=jwvpmypraz0.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=daniel@mendler.net \
    --cc=emacs-devel@gnu.org \
    /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).