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 #41 received at 78719 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Daniel Mendler <mail <at> daniel-mendler.de>, 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: Wed, 11 Jun 2025 01:51:29 +1200
> From: Phil Sainty <psainty <at> orcon.net.nz>
>> Is it ok to (eval-when-compile (require 'cl-lib)) in subr.el
>> in order to use cl-defun ?

Eli Zaretskii wrote:
> Can we please avoid that at all costs?

and Stefan Monnier wrote:
> No, it's not.  I mean, maybe there's a way to make it work, but if you
> "just do it", bootstrap will break because `cl-lib` needs `subr.el`.

Righto.  I figured the answers might well be along these lines.


> Much better to refrain from using `cl-defun`, or else move the
> definition to a later file, like `simple.el` or `subr-x.el`.

All good.


On 2025-06-11 00:15, Eli Zaretskii wrote:
> Why do we need cl-defun here, anyway?  How many arguments should these
> functions have?

There's one mandatory argument and four optional ones which
can be mixed and matched without any obvious priority sequence.
Daniel had used cl-defun when he suggested merging my original
two functions into one, and I thought that the use of keyword
args did seem like a nicer API than a regular function.

It could be a regular function, though; I don't think there
was anything *precluding* that.  I'd probably go with this
argument order if we do that:

(string-common-prefix COLLECTION &optional IGNORE-CASE STRING 
REGEXP-LIST PREDICATE)


-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.