Subject: Re: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion'

From: Daniel Mendler <[email-masked]>
Date: Fri, 18 Jul 2025 11:38:18 +0200

Eli Zaretskii <[email-masked]> writes:

>> Date: Fri, 18 Jul 2025 16:01:08 +1200
>> From: Phil Sainty <[email-masked]>
>> Cc: Eli Zaretskii <[email-masked]>, [email-masked],
>>  [email-masked], [email-masked], [email-masked]
>> 
>> On 2025-07-06 03:29, Daniel Mendler wrote:
>> > Then we can maybe convince Eli that the following calling convention is
>> > better, since the filtering arguments STRING and REGEXP-LIST are
>> > deprioritized? The STRING and REGEXP-LIST arguments are
>> > completion-related, while IGNORE-CASE is needed for basic
>> > case-insensitive prefix computation.
>> > 
>> > (string-common-prefix LIST &optional IGNORE-CASE STRING REGEXP-LIST)
>> > 
>> > Alternatively we could go with the simplest form and suggest to use
>> > `try-completion' if additional filtering is needed.
>> > 
>> > (string-common-prefix LIST &optional IGNORE-CASE)
>> 
>> I'm happy to proceed with either option.
>
> My vote is for the much simpler latter API, even after reading your
> benchmarks.  I thought having such a simple API was the goal from the
> get-go.

I am okay with the simpler API. If users want filtering functionality,
they can use `try-completion' (for a common prefix) or `all-completions'
(for matching candidates) directly. The docstring of
`string-common-prefix' should point users to `try-completion', where
they can find the advanced filtering functionality beyond simple prefix
computation.

Daniel