bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#42149: Substring and flex completion ignore implicit trailing ‘any’


From: João Távora
Subject: bug#42149: Substring and flex completion ignore implicit trailing ‘any’
Date: Wed, 01 Jul 2020 12:03:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Dario Gjorgjevski <dario.gjorgjevski@gmail.com> writes:

> > Hi,
> >
> > I have found out that substring and flex completion ignore the implicit
> > trailing ‘any’ introduced by ‘completion-pcm--optimize-pattern’.  This
> > is evident from the examples shown next.
> >
> > My Emacs version is 28.0.50, built on 2020-07-01 from commit e98ddd6fc1.
> >
> > Example 1
> > =========
> >
> >   (completion-substring-all-completions "f" (list "f") nil 1)
> >
> > and
> >
> >   (completion-flex-all-completions "f" (list "f") nil 1)
> >
> > both result in
> >
> >   (#("f" 0 1 (face completions-common-part completion-score 0.0)) . 0)
> >
> > whereas I would expect a completion score of 1.
> >
> > Example 2
> > =========
> >
> >   (completion-substring-all-completions "fo" (list "fo") nil 1)
> >
> > results in
> >
> >   (#("fo" 0 1 (face completions-common-part completion-score 0.5) 1 2
> >     (face (completions-first-difference completions-common-part))) . 0)
> >
> But does the problem also manifest itself with two-character
> completions?  I.e. is the 0.5 perfect match for "fo" (in the example you
> gave) ever surpassed by another, presumably less good, match?

Answering my own question, the answer seems to be "no".

   (completion-substring-all-completions "fo" (list "f" "fo" "foot") nil 1)
   (#("fo" 0 1
      (face completions-common-part completion-score 0.5)
      1 2
      (face
       (completions-first-difference completions-common-part)))
    #("foot" 0 1
      (face completions-common-part completion-score 0.25)
      1 2
      (face
       (completions-first-difference completions-common-part)))
    . 0)


But indeed there is the problem of the 1-long.  And the problem is that
_every_ completion gets 0.

   (completion-substring-all-completions "f" (list "f" "fo" "foot") nil 1)
   (#("f" 0 1
      (face completions-common-part completion-score 0.0))
    #("fo" 0 1
      (face completions-common-part completion-score 0.0)
      1 2
      (face completions-first-difference))
    #("foot" 0 1
      (face completions-common-part completion-score 0.0)
      1 2
      (face completions-first-difference))
    . 0)

I still don't know what the proper fix this, just adding some
information I think is relevant.

Thanks,
João





reply via email to

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