[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 21501968fe 2/3: consult--focus-lines-state: Avo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 21501968fe 2/3: consult--focus-lines-state: Avoid a cons pair allocation |
Date: |
Tue, 11 Jan 2022 06:57:21 -0500 (EST) |
branch: externals/consult
commit 21501968fe3256ad23ed09b98d5e6bc435a9f69f
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
consult--focus-lines-state: Avoid a cons pair allocation
---
consult.el | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/consult.el b/consult.el
index fe34934160..891b968f75 100644
--- a/consult.el
+++ b/consult.el
@@ -3015,7 +3015,7 @@ INITIAL is the initial input."
(consult--each-line beg end
(let ((line (if (eq beg end) (char-to-string ?\n)
(buffer-substring-no-properties beg end))))
- (put-text-property 0 1 'line `(,(cl-incf i) ,beg . ,end) line)
+ (put-text-property 0 1 'line (cons (cl-incf i) beg) line)
(push line lines)))
(setq lines (nreverse lines)))))
(lambda (input restore)
@@ -3035,17 +3035,19 @@ INITIAL is the initial input."
(block-end pt-min))
(unless (eq matches t) ;; input arrived
(while old-ind
- (pcase-let ((`(,ind ,beg . ,end)
- (if matches
- (get-text-property 0 'line (pop matches))
- `(nil ,pt-max . ,pt-max))))
+ (let ((match (pop matches)) (ind nil) (beg pt-max) (end
pt-max) prop)
+ (when match
+ (setq prop (get-text-property 0 'line match)
+ ind (car prop)
+ beg (cdr prop)
+ end (+ 1 beg (length match))))
(unless (eq ind (1+ old-ind))
(let ((a (if not block-beg block-end))
(b (if not block-end beg)))
(when (/= a b)
(push (consult--overlay a b 'invisible t) overlays)))
(setq block-beg beg))
- (setq block-end (1+ end) old-ind ind)))))))
+ (setq block-end end old-ind ind)))))))
(when restore
(cond
((not input)