summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2021-06-07 00:57:42 +0300
committerDmitry Gutov <dgutov@yandex.ru>2021-06-07 00:57:50 +0300
commit6329e70460137e34abbc7590c5892623547f9b26 (patch)
tree309f3b2d36e44e94f2fa92ed1944dd84fabf16ef /lisp/minibuffer.el
parentfc37483617e09fb901c075dd20cfb7b2c2a165fe (diff)
downloademacs-6329e70460137e34abbc7590c5892623547f9b26.tar.gz
emacs-6329e70460137e34abbc7590c5892623547f9b26.tar.bz2
emacs-6329e70460137e34abbc7590c5892623547f9b26.zip
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).
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index ec21b7b93b6..d5a0118b7c0 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