emacs-diffs
[Top][All Lists]
Advanced

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

master 6329e70: completion-pcm--hilit-commonality: Reuse the match-data


From: Dmitry Gutov
Subject: master 6329e70: completion-pcm--hilit-commonality: Reuse the match-data cons cells
Date: Sun, 6 Jun 2021 17:58:04 -0400 (EDT)

branch: master
commit 6329e70460137e34abbc7590c5892623547f9b26
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    completion-pcm--hilit-commonality: Reuse the match-data cons cells
    
    * lisp/minibuffer.el (completion-pcm--hilit-commonality): Reuse
    the match-data cons cells for better performance (bug#48841).
---
 lisp/minibuffer.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index ec21b7b..d5a0118 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3484,7 +3484,8 @@ between 0 and 1, and with faces `completions-common-part',
   (when completions
     (let* ((re (completion-pcm--pattern->regex pattern 'group))
            (point-idx (completion-pcm--pattern-point-idx pattern))
-           (case-fold-search completion-ignore-case))
+           (case-fold-search completion-ignore-case)
+           last-md)
       (mapcar
        (lambda (str)
         ;; Don't modify the string itself.
@@ -3493,7 +3494,7 @@ between 0 and 1, and with faces `completions-common-part',
            (error "Internal error: %s does not match %s" re str))
          (let* ((pos (if point-idx (match-beginning point-idx) (match-end 0)))
                 (match-end (match-end 0))
-                (md (cddr (match-data)))
+                (md (cddr (setq last-md (match-data t last-md))))
                 (from 0)
                 (end (length str))
                 ;; To understand how this works, consider these simple



reply via email to

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