GNU bug report logs - #65137
29.1; completion-substring-try-completion doesn't return the longest common substring

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Mon, 7 Aug 2023 23:25:01 UTC

Severity: normal

Found in version 29.1

Fixed in version 30.1

Done: Spencer Baugh <sbaugh <at> janestreet.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: sbaugh <at> catern.com, Eli Zaretskii <eliz <at> gnu.org>, 65137 <at> debbugs.gnu.org
Subject: bug#65137: 29.1; completion-substring-try-completion doesn't return the longest common substring
Date: Tue, 05 Sep 2023 17:26:00 -0400
> Patch with test:

Thanks, pushed.

>> Similarly, I see that
>>
>>     (completion-pcm--merge-completions '("abr" "absabr") '(prefix "br"))
>>
>> returns
>>
>>     ("br" prefix)
>>
>> whereas it should arguably return
>>
>>     ("br" "a" prefix)
>>
>> [ Tho this may have the side effect that after this completion, `absabr`
>>   won't be considered any more, if the `basic` completion comes before
>>   `substring` :-(  ]

> I did notice this too.  I could try fixing/changing this too, but it
> does seem annoying when basic comes before substring - as it does by
> default in a number of completion categories.

Yup :-(

I have often wished for there to be a way to remember the style that was
used so as to try and avoid such "style capture".

> I wonder if we should move basic to after substring in those
> categories in completion-category-defaults?

It's a tradeoff: the default is designed to reduce the factor of
surprise for people used to the default (i.e. to mostly prefix completion).

> Or just remove basic from them.

Same difference :-)

> It doesn't seem like having both basic and substring in those lists
> has much point.

If you're used to relying on `substring` indeed it's not helpful.
But if you're used to using mostly prefix-based completion (which may
have the effect that you choose your names such that prefix completion
works well), it can be helpful to have `substring` as a fallback when
you can't remember what prefix to use for the thing you're looking for.


        Stefan





This bug report was last modified 1 year and 281 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.