guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#45893] [PATCH 0/2] DRAFT: Hint for options.


From: Ludovic Courtès
Subject: [bug#45893] [PATCH 0/2] DRAFT: Hint for options.
Date: Tue, 26 Jan 2021 21:53:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi,

zimoun <zimon.toutoune@gmail.com> skribis:

> On Tue, 19 Jan 2021 at 18:38, Ludovic Courtès <ludo@gnu.org> wrote:
>>
>> zimoun <zimon.toutoune@gmail.com> skribis:
>>
>> > * guix/ui.scm (run-guix-command): Add command hint.
>>
>> [...]
>>
>> > +    (fold (lambda (name res)
>> > +            (if (string-null? res)
>> > +                (string-append  "@code{" name "}")
>> > +                (string-append "@code{" name "}, " res)))
>> > +          ""
>> > +          (string-closest (symbol->string guess) command-names)))
>>
>> Hmm I thought ‘string-closest’ would return a single string, but
>> actually it returns a list of strings?
>>
>> You cannot append strings together like this as this can break i18n.
>
> Hum?  But it is not (G_ "")...

Yes, but here you’re building an enumeration like:

  ‘foo’, ‘bar’, ‘baz’

This should be i18n’d, and so it should all be in a single format
string.

> Hehe!  I have tried...  But it is not "doable" in practise... well, I
> find it too slow.  The natural improvement is to cut down the
> levenhstein-distance by stopping if the score is greater than
> threshold.  Well, I have not tried yet. :-)

Oh I see.  Perhaps instead of (or in addition to) ‘string-distance’, you
need something like (string-distance<? a b len) ?

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]