GNU bug report logs - #78719
30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion'

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Sun, 8 Jun 2025 12:05:01 UTC

Severity: normal

Tags: patch

Found in version 30.1

Full log


Message #23 received at 78719 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Daniel Mendler <mail <at> daniel-mendler.de>
Cc: Phil Sainty <psainty <at> orcon.net.nz>, eliz <at> gnu.org, 78719 <at> debbugs.gnu.org,
 drew.adams <at> oracle.com, juri <at> linkov.net
Subject: Re: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix'
 and `string-try-completion'
Date: Mon, 09 Jun 2025 06:48:11 -0400
> I think it is confusing if the function respects the
> `completion-regexp-list' and `completion-ignore-case' dynamic
> variables,

Strong agreement, here.  It's arguably already a problem to use those
dynbound variables in `try-completion`, so it's even worse here for
a function which wants to be unrelated to completion.

> and if we end up with three functions
> `try-completion', `string-try-completion', and
> `completions-try-completion'.
>
> Why not only provide a single function `string-expand-prefix' with
> additional keyword or optional arguments:
>
> (cl-defun string-common-prefix (strings &key ignore-case regexps predicate))

The "try completion" part of the name sounds like it's motivated by the
historical accident of how we got to it, so if we want to help those
who're not familiar with (or thinking about) completion, a name like
`string-common-prefix` sounds better, indeed.

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.

> (cl-defun string-common-prefix (strings &key prefix ignore-case regexps predicate))

At this point, you might as well call `try-completion`.


        Stefan





This bug report was last modified 4 days ago.

Previous Next


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