Subject: Re: bug#39484: 26.3; try-completion bug

From: Stefan Monnier <[email-masked]>
Date: Wed, 28 Oct 2020 12:34:00 -0400

> The examples I gave are real life situations.

All the examples I see are of the "abcd" or "xyz", i.e. made up examples.
I understand they are meant to illustrate real-life examples, but they
are not themselves real life.

> 1. x is a prefix of y, ignoring case.
> 2. y is the maximum common prefix, ignoring case, among all candidates

That's what is guaranteed by the semantics, so our code already does
that (barring bugs).

> 3. y is the *exact* (including case) prefix of at least one of the
>    candidates

We could try that, indeed.  It still satisfies the constraint
I described as "conservative", and it wouldn't cost extra
efforts either.

If someone wants to try that, feel free to do so, but I personally would
prefer if we only do that when all the matching candidates agree on
the capitalization.

BTW, we currently have the following tests in test/src/minibuffer-tests.el:

    (ert-deftest test-try-completion-ignore-case ()
      (let ((completion-ignore-case t))
        (should (equal (try-completion "bar" '("bAr" "barfoo")) "bAr"))
        (should (equal (try-completion "bar" '("bArfoo" "barbaz")) "bar"))
        (should (equal (try-completion "bar" '("bArfoo" "barbaz"))
                       (try-completion "bar" '("barbaz" "bArfoo"))))
        ;; bug#11339
        (should (equal (try-completion "baz" '("baz" "bAz")) "baz")) ;And not `t'!
        (should (equal (try-completion "baz" '("bAz" "baz"))
                       (try-completion "baz" '("baz" "bAz"))))))

-- Stefan