1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-07 06:50:23 -08:00

fixup! Subsume string-try-completion' into string-common-prefix'

This commit is contained in:
Phil Sainty 2025-06-29 14:28:51 +12:00
parent 1e1eef5fb0
commit c6ecba08dd
2 changed files with 23 additions and 19 deletions

View file

@ -261,12 +261,6 @@ contains exactly one string, it returns that string.
@result{} "foo" @result{} "foo"
@end example @end example
This is similar to @code{try-completion} (@pxref{Basic Completion}),
except that it always returns a string.
@var{collection} may be a list of strings or any other value supported
by @code{try-completion}.
If @var{ignore-case} is non-@code{nil}, letter case is ignored when If @var{ignore-case} is non-@code{nil}, letter case is ignored when
matching the substrings, but no guarantee is made about the letter-case matching the substrings, but no guarantee is made about the letter-case
of the return value, except that it comes from one of the members of of the return value, except that it comes from one of the members of
@ -288,9 +282,9 @@ are ignored.
@result{} "foo" @result{} "foo"
@end example @end example
If @var{regexp-list} is non-@code{nil}, it is used as If @var{regexp-list} is non-@code{nil}, any members of @var{collection}
@code{completion-regexp-list}, and any members of @var{collection} which which do not match all of the regular expressions in this list are
do not match all of the regular expressions in this list are ignored. ignored.
@example @example
(string-common-prefix '("foobar" "foozot" "gazonk") "f" nil '("z")) (string-common-prefix '("foobar" "foozot" "gazonk") "f" nil '("z"))
@ -299,10 +293,18 @@ do not match all of the regular expressions in this list are ignored.
If @var{predicate} is non-@code{nil}, it must be a function to which If @var{predicate} is non-@code{nil}, it must be a function to which
each member of @var{collection} will be passed, and any members for each member of @var{collection} will be passed, and any members for
which @var{predicate} returns @code{nil} are ignored. See which @var{predicate} returns @code{nil} are ignored. When
@code{try-completion} (@pxref{Basic Completion}) for details of how the @var{collection} is a list of strings, the function receives a single
@var{predicate} argument is used for different types of string argument.
@var{collection}.
@var{collection} may be a list of strings or any other value supported
by @code{try-completion} (@pxref{Basic Completion}). The requirements
for a @var{predicate} function vary depending on the @var{collection}
type; refer to @code{try-completion} for details of using different
@var{collection} types.
This function is similar to @code{try-completion}, but always returns a
string.
@end defun @end defun
@defun concat &rest sequences @defun concat &rest sequences

View file

@ -6019,18 +6019,20 @@ the longest common prefix for the remaining members.
If STRING is non-nil, this is the minimum required prefix, and any If STRING is non-nil, this is the minimum required prefix, and any
members of COLLECTION which do not start with STRING are ignored. members of COLLECTION which do not start with STRING are ignored.
If REGEXP-LIST is non-nil, it is used as `completion-regexp-list', If REGEXP-LIST is non-nil, any members of COLLECTION which do not match
and any members of COLLECTION which do not match all of the regular all of the regular expressions in this list are ignored.
expressions in this list are ignored.
If PREDICATE is non-nil, it must be a function to which each member of If PREDICATE is non-nil, it must be a function to which each member of
COLLECTION will be passed, and any members for which PREDICATE returns COLLECTION will be passed, and any members for which PREDICATE returns
nil are ignored. See `try-completion' for more details. nil are ignored. When COLLECTION is a list of strings, the function
receives a single string argument.
COLLECTION may be a list of strings or any other value supported by COLLECTION may be a list of strings or any other value supported by
`try-completion'. `try-completion'. The requirements for a PREDICATE function vary
depending on the COLLECTION type; refer to `try-completion' for details
of using different COLLECTION types.
This function is similar to `try-completion', but always returning a This function is similar to `try-completion', but always returns a
string." string."
;; Note that `try-completion' is not affected by `completion-styles'. ;; Note that `try-completion' is not affected by `completion-styles'.
(let* ((completion-ignore-case ignore-case) (let* ((completion-ignore-case ignore-case)