[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master bf8dc5f 326/348: Make swiper-avy work with more regexp bui
From: |
Oleh Krehel |
Subject: |
[elpa] master bf8dc5f 326/348: Make swiper-avy work with more regexp builders |
Date: |
Sat, 8 Apr 2017 11:04:24 -0400 (EDT) |
branch: master
commit bf8dc5f778cbac27629162e07f798032310552cf
Author: Dale Sedivec <address@hidden>
Commit: Dale Sedivec <address@hidden>
Make swiper-avy work with more regexp builders
Previously, if you were using regexp builders such as ivy--regex-fuzzy
or ivy--regex-ignore-order, or anything for which ivy--regex doesn't
produce a useful match, swiper-avy would not find candidates in the
window where you invoked swiper. These changes leverage the existing
overlays in the window, which were presumably added with the help of
your chosen regexp builder, to find candidates for Avy.
---
swiper.el | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/swiper.el b/swiper.el
index f8a9fce..ce7c07c 100644
--- a/swiper.el
+++ b/swiper.el
@@ -156,10 +156,28 @@
(error "Package avy isn't installed"))
(unless (string= ivy-text "")
(let* ((avy-all-windows nil)
+ ;; We'll have overlapping overlays, so we sort all the
+ ;; overlays in the visible region by their start, and then
+ ;; throw out non-Swiper overlays or overlapping Swiper
+ ;; overlays.
+ (visible-overlays (cl-sort (with-ivy-window
+ (overlays-in (window-start)
+ (window-end)))
+ #'< :key #'overlay-start))
+ (min-overlay-start 0)
+ (overlays-for-avy (cl-remove-if-not
+ (lambda (ov)
+ (when (and (>= (overlay-start ov)
+ min-overlay-start)
+ (memq (overlay-get ov 'face)
+ swiper-faces))
+ (setq min-overlay-start (overlay-start ov))))
+ visible-overlays))
(candidates (append
- (with-ivy-window
- (avy--regex-candidates
- (ivy--regex ivy-text)))
+ (mapcar (lambda (ov)
+ (cons (overlay-start ov)
+ (overlay-get ov 'window)))
+ overlays-for-avy)
(save-excursion
(save-restriction
(narrow-to-region (window-start) (window-end))
@@ -192,7 +210,7 @@
(ivy-done)
(ivy-call))
(ivy-quit-and-run
- (avy-action-goto (caar candidate)))))))
+ (avy-action-goto (avy-candidate-beg candidate)))))))
(declare-function mc/create-fake-cursor-at-point "ext:multiple-cursors-core")
(declare-function multiple-cursors-mode "ext:multiple-cursors-core")
- [elpa] master 8f87f74 178/348: counsel.el (counsel-git-grep): Update for Windows, (continued)
- [elpa] master 8f87f74 178/348: counsel.el (counsel-git-grep): Update for Windows, Oleh Krehel, 2017/04/08
- [elpa] master 79105a5 208/348: counsel.el (counsel-info-lookup-symbol): Add preselect, Oleh Krehel, 2017/04/08
- [elpa] master 222a5e6 217/348: ivy.el (ivy--virtual-buffers): Move to silence compiler, Oleh Krehel, 2017/04/08
- [elpa] master 35b5d29 230/348: New example to show how to associate values, Oleh Krehel, 2017/04/08
- [elpa] master e9c274a 236/348: Allow to customize ivy-display-function per caller, Oleh Krehel, 2017/04/08
- [elpa] master c14ceac 245/348: Add support for counsel-find-library, Oleh Krehel, 2017/04/08
- [elpa] master ca84f24 269/348: Add highlighter function configuration to ivy, Oleh Krehel, 2017/04/08
- [elpa] master 5701444 314/348: ivy.el (ivy-occur-revert-buffer): Restore ivy-occur-last, Oleh Krehel, 2017/04/08
- [elpa] master 13def15 318/348: ivy.el (ivy-case-fold-search): Add additional value 'always, Oleh Krehel, 2017/04/08
- [elpa] master 54c5447 319/348: counsel.el (counsel-grep-function): Add shell-quote-argument, Oleh Krehel, 2017/04/08
- [elpa] master bf8dc5f 326/348: Make swiper-avy work with more regexp builders,
Oleh Krehel <=
- [elpa] master 03f90af 324/348: ivy.el (ivy-rotate-sort): Guard against nil sort, Oleh Krehel, 2017/04/08
- [elpa] master ac944ea 325/348: ivy.el: Remove with-ivy-window, Oleh Krehel, 2017/04/08
- [elpa] master 18da759 320/348: ivy.el: Remove ivy--current, Oleh Krehel, 2017/04/08
- [elpa] master 20744aa 337/348: doc/Changelog.org: Prepare for 0.9.0, Oleh Krehel, 2017/04/08
- [elpa] master 13a3f2d 342/348: doc/Changelog.org: Sort stuff, Oleh Krehel, 2017/04/08
- [elpa] master 69dfed9 146/348: counsel.el (counsel-dpkg): Remove typo, Oleh Krehel, 2017/04/08
- [elpa] master 55a90c9 152/348: Make with-ivy-window not necessary in action, Oleh Krehel, 2017/04/08
- [elpa] master 9d693ec 158/348: Use a lighter color for ivy-remote in dark themes, Oleh Krehel, 2017/04/08
- [elpa] master 9b13aa4 170/348: ivy.el (ivy-flip): Allow to flip candidates/input, Oleh Krehel, 2017/04/08
- [elpa] master 2bc1d7b 276/348: ivy.el (ivy--occur-insert-lines): Scroll to first cand, Oleh Krehel, 2017/04/08