[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: |
Mon, 28 Dec 2020 17:04:42 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Regardless, if you don't want to touch that funciton, I understand, it
>> is used in more places than just completion-pcm--hilit-commonality,
>> which really should be called
>>
>> completion--given-that-we-know-this-matches-tell-me-where-and-how-well
>
> Hmm... until someone™ added scoring to it, this function did nothing
> more than add faces to highlight the common parts and the "first
> difference". So I'd suggest you take it up with that someone ;-)
:-)
Grumblebgrumpbl. I kinda did, and so I added a docstring to it (have a
read). Anyway, what's suprising about this function is that this
re-matches PATTERN to each of COMPLETIONS which is very odd to the
reader, becasue it also asserts that PATTERN already matches
COMPLETIONS. Why are we regexp-matching twice?! -- asks the poor soul
reading this.
This comes down to completion-regexp-list being used by
Fall_completions() directly. If that C function recorded the match data
in all the lisp strings it was passed, then completion--given-that...
would be easier follow. And likely faster. Though I haven't measured
the impact, sparing a regexp match against each completion might be
worth it in terms of responsiveness, especially in flex and similar
methods.
João
bug#42149: Substring and flex completion ignore implicit trailing ‘any’, Dario Gjorgjevski, 2020/12/28