[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master b05ae24 254/399: swiper.el (swiper--add-properties): Extra
From: |
Oleh Krehel |
Subject: |
[elpa] master b05ae24 254/399: swiper.el (swiper--add-properties): Extract |
Date: |
Sat, 20 Jul 2019 14:57:35 -0400 (EDT) |
branch: master
commit b05ae248f629040e61c76a74c645562abc1b559c
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el (swiper--add-properties): Extract
---
swiper.el | 65 ++++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 35 insertions(+), 30 deletions(-)
diff --git a/swiper.el b/swiper.el
index 09c51e8..ec73b5e 100644
--- a/swiper.el
+++ b/swiper.el
@@ -899,9 +899,12 @@ WND, when specified is the window."
;; greater otherwise. We hope that the inclusion of the
;; newline will not ever be a problem in practice.
(when (< (count-lines (match-beginning 0) (match-end 0)) 2)
- (let ((faces (if (= (match-end 0) pt)
- swiper-faces
- swiper-background-faces)))
+ (let* ((faces (if (= (match-end 0) pt)
+ swiper-faces
+ swiper-background-faces))
+ (adder-fn (lambda (beg end face priority)
+ (push (swiper--make-overlay beg end face wnd
priority)
+ isearch-lazy-highlight-overlays))))
(unless (and (consp ivy--old-re)
(null
(save-match-data
@@ -910,33 +913,35 @@ WND, when specified is the window."
(buffer-substring-no-properties
(line-beginning-position)
(line-end-position)))))))
- (let ((mb (match-beginning 0))
- (me (match-end 0)))
- (unless (> (- me mb) 2017)
- (push (swiper--make-overlay mb me
- (if (zerop ivy--subexps)
- (cadr faces)
- (car faces))
- wnd 0)
- isearch-lazy-highlight-overlays))))
- (let ((i 1)
- (j 0))
- (while (<= (cl-incf j) ivy--subexps)
- (let ((bm (match-beginning j))
- (em (match-end j)))
- (when (and (integerp em)
- (integerp bm))
- (while (and (< j ivy--subexps)
- (integerp (match-beginning (+ j 1)))
- (= em (match-beginning (+ j 1))))
- (setq em (match-end (cl-incf j))))
- (push (swiper--make-overlay
- bm em
- (nth (1+ (mod (+ i 2) (1- (length faces))))
- faces)
- wnd i)
- isearch-lazy-highlight-overlays)
- (cl-incf i))))))))))))
+ (swiper--add-properties faces adder-fn)))))))))
+
+(defun swiper--add-properties (faces adder-fn)
+ (let ((mb (match-beginning 0))
+ (me (match-end 0)))
+ (unless (> (- me mb) 2017)
+ (funcall adder-fn
+ mb me
+ (if (zerop ivy--subexps)
+ (cadr faces)
+ (car faces))
+ 0)))
+ (let ((i 1)
+ (j 0))
+ (while (<= (cl-incf j) ivy--subexps)
+ (let ((bm (match-beginning j))
+ (em (match-end j)))
+ (when (and (integerp em)
+ (integerp bm))
+ (while (and (< j ivy--subexps)
+ (integerp (match-beginning (+ j 1)))
+ (= em (match-beginning (+ j 1))))
+ (setq em (match-end (cl-incf j))))
+ (funcall adder-fn
+ bm em
+ (nth (1+ (mod (+ i 2) (1- (length faces))))
+ faces)
+ i)
+ (cl-incf i))))))
(defcustom swiper-action-recenter nil
"When non-nil, recenter after exiting `swiper'."
- [elpa] master 773ac65 245/399: swiper.el (swiper--cleanup): Re-use lazy-highlight-cleanup, (continued)
- [elpa] master 773ac65 245/399: swiper.el (swiper--cleanup): Re-use lazy-highlight-cleanup, Oleh Krehel, 2019/07/20
- [elpa] master 815f094 252/399: swiper.el (swiper--add-line-overlay): Extract, Oleh Krehel, 2019/07/20
- [elpa] master eb1e636 253/399: swiper.el (swiper--add-cursor-overlay): Display only in current window, Oleh Krehel, 2019/07/20
- [elpa] master 7dc1445 256/399: swiper.el (swiper-isearch): Use the same faces in the minibuffer, Oleh Krehel, 2019/07/20
- [elpa] master 4d40f88 255/399: swiper.el (swiper--isearch-function): Speedup for big files, Oleh Krehel, 2019/07/20
- [elpa] master 2ce81eb 240/399: swiper.el (swiper-isearch-toggle): Extend doc, Oleh Krehel, 2019/07/20
- [elpa] master cc92e1c 238/399: swiper.el (swiper--avy-goto): Handle quit, Oleh Krehel, 2019/07/20
- [elpa] master e6f49c2 244/399: swiper.el: Reorder by swiper--overlays, Oleh Krehel, 2019/07/20
- [elpa] master e04b10c 248/399: swiper.el (swiper-isearch-function): Refactor, Oleh Krehel, 2019/07/20
- [elpa] master ee71733 247/399: ivy.el (ivy-switch-buffer-other-window): Fix ivy-use-virtual-buffers, Oleh Krehel, 2019/07/20
- [elpa] master b05ae24 254/399: swiper.el (swiper--add-properties): Extract,
Oleh Krehel <=
- [elpa] master db3e307 250/399: swiper.el (swiper--isearch-format): Extract, Oleh Krehel, 2019/07/20
- [elpa] master 58b6f7d 257/399: swiper.el (swiper--isearch-format): Don't use blending for the current match, Oleh Krehel, 2019/07/20
- [elpa] master f628441 259/399: swiper.el (swiper-isearch): Fix "C-r", Oleh Krehel, 2019/07/20
- [elpa] master 743163c 260/399: counsel.el (counsel-minor-history): New history variable, Oleh Krehel, 2019/07/20
- [elpa] master cbb3ee1 262/399: counsel.el (counsel-company): Don't rely on company-point, Oleh Krehel, 2019/07/20
- [elpa] master 77a5ffc 261/399: counsel.el (counsel-package-history): New history variable, Oleh Krehel, 2019/07/20
- [elpa] master d5c9673 265/399: swiper.el (swiper--isearch-format): Fix permanent face modifications, Oleh Krehel, 2019/07/20
- [elpa] master 2c57036 263/399: ivy.el (ivy-call): Modify the API for ivy-action second arg, Oleh Krehel, 2019/07/20
- [elpa] master bea44b7 264/399: counsel.el: Fix compiler warnings, Oleh Krehel, 2019/07/20
- [elpa] master a2af29b 271/399: ivy.el (ivy--occur-insert-lines): Fix missing line numbers, Oleh Krehel, 2019/07/20