[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#42149: Substring and flex completion ignore implicit trailing ‘any’
From: |
Dario Gjorgjevski |
Subject: |
bug#42149: Substring and flex completion ignore implicit trailing ‘any’ |
Date: |
Wed, 01 Jul 2020 13:10:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Hi João,
> I still don't know what the proper fix this, just adding some
> information I think is relevant.
Indeed the problem is that they all get a completion score of 0, and I
would expect the exact match to get a score of 1.
You’re right that we can also modify the algorithm of
‘completion-pcm--hilit-commonality’.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index d2c3f9045e..e1f1ffed1c 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3251,6 +3251,9 @@ one-letter-long matches).")
(update-score
(lambda (a b)
"Update score variables given match range (A B)."
+ (add-face-text-property a b
+ 'completions-common-part
+ nil str)
(setq
score-numerator (+ score-numerator (- b a)))
(unless (or (= a last-b)
@@ -3264,19 +3267,10 @@ one-letter-long matches).")
flex-score-match-tightness)))))
(setq
last-b b))))
- (funcall update-score start start)
(while md
- (funcall update-score start (car md))
- (add-face-text-property
- start (pop md)
- 'completions-common-part
- nil str)
+ (funcall update-score start (pop md))
(setq start (pop md)))
- (funcall update-score len len)
- (add-face-text-property
- start end
- 'completions-common-part
- nil str)
+ (funcall update-score start end)
(if (> (length str) pos)
(add-face-text-property
pos (1+ pos)
This modification also solves the issue (and simplifies the code a
little bit), but I’m not sure of unwanted side effects.
Best regards,
Dario
--
dario.gjorgjevski@gmail.com :: +49 1525 8666837
% gpg --keyserver 'hkps://hkps.pool.sks-keyservers.net' \
\`> --recv-keys '744A4F0B4F1C9371'