emacs-diffs
[Top][All Lists]
Advanced

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

scratch/bug-42149-funny-pcm-completion-scores ec02ae5 4/6: Robustify com


From: João Távora
Subject: scratch/bug-42149-funny-pcm-completion-scores ec02ae5 4/6: Robustify completion match scoring for incomplete/implicit patterns
Date: Mon, 28 Dec 2020 04:29:27 -0500 (EST)

branch: scratch/bug-42149-funny-pcm-completion-scores
commit ec02ae5a3af91f6bec06bbf08b7df841f772d15f
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Robustify completion match scoring for incomplete/implicit patterns
    
    completion-pcm--hilit-commonality, which propertizes and scores a
    previously confirmed match, expects PATTERN to match the strings `of
    COMPLETIONS entirely.  In this patch, we take care that the main goal
    of this function, isn't affected by some optimzations that transform
    PATTERN beforehand.
    
    * lisp/minibuffer.el (completion-pcm--hilit-commonality):
    Initialize start to 0 and end to the length of the string.
---
 lisp/minibuffer.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 7d05f77..df4ec67 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3255,10 +3255,10 @@ one-letter-long matches).")
          (unless (string-match re str)
            (error "Internal error: %s does not match %s" re str))
          (let* ((pos (if point-idx (match-beginning point-idx) (match-end 0)))
-                (md (match-data))
-                (start (pop md))
-                (end (pop md))
+                (md (cddr (match-data)))
+                (start 0)
                 (len (length str))
+                (end len)
                 ;; To understand how this works, consider these bad
                 ;; ascii(tm) diagrams showing how the pattern "foo"
                 ;; flex-matches "fabrobazo", "fbarbazoo" and



reply via email to

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