GNU bug report logs -
#78719
30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion'
Previous Next
Full log
View this message in rfc822 format
On 2025-06-09 22:56, Daniel Mendler wrote:
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> > Do we have reasons to believe callers will want/need those
> > `&key` arguments? My gut tells me we don't need the
> > `predicate` and `regexps` options.
>
> Yes, I think it makes sense to only offer the simplest
> function without additional features, since the goal is a
> simpler API after all to obtain common prefixes.
>
> (defun string-common-prefix (strings &key ignore-case))
>
> If additional completion features are needed, we can refer
> the user to `try-completion' in the docstring or the manual.
We essentially get that extra functionality for free, so I see
no reason not to leverage that by supporting it in the new
function.
My original two-function approach was to provide that 'simplest'
function while also ensuring that the extra features were still
available without callers having to account for the various
non-string return values from `try-completion'. So I don't like
the idea of `try-completion' being the only option for someone
who wants to use the extra features.
I'm happy to go with the single function approach, as the
cl-defun approach keeps the API simple in the simple case, but
I think the extra keywords should be supported. I'm happy to
implement that.
Is it ok to (eval-when-compile (require 'cl-lib)) in subr.el
in order to use cl-defun ?
-Phil
This bug report was last modified 5 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.