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
> Date: Sun, 06 Jul 2025 02:04:27 +1200
> From: Phil Sainty <psainty <at> orcon.net.nz>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, monnier <at> iro.umontreal.ca,
> 78719 <at> debbugs.gnu.org, drew.adams <at> oracle.com, juri <at> linkov.net
>
> I'm not talking about the complexity of the functionality, but rather
> the complexity of *using* the function.
>
> I'm arguing that if you're not trying to write completion code, it's
> horrible to have to write (and read) this:
>
> (let* ((completion-ignore-case nil)
> (completion-regexp-list regexp-list)
> (prefix (try-completion "" collection)))
> (if (stringp prefix)
> prefix
> (if (eq t prefix)
>
> ""))))
>
> when it can simply be:
>
> (string-common-prefix collection nil nil regexp-list)
I don't find the above horrible at all. And it would be even easier
to read if rewritten as follows:
(let* ((completion-ignore-case nil)
(prefix (try-completion (or string "") collection)))
(cond
((stringp prefix)
prefix)
((eq t prefix)
string)
(t "")))
Why is the above "horrible" or not easy to read and understand?
I did agree that a dedicated API for finding the common prefix of a
set of strings would be better, but it should be not harder to use
than the above.
This bug report was last modified 57 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.