Make avy-goto-char-timer faster for org-mode

* avy.el (avy--read-string-timer): Use `avy--find-visible-regions'.
(avy-goto-char-timer): Make ARG work properly to negate
`avy-all-windows'.

Re #100
This commit is contained in:
Oleh Krehel 2015-10-21 12:38:14 +02:00
parent 528125e096
commit 513c42991c

16
avy.el
View File

@ -1132,15 +1132,18 @@ read string immediately instead of waiting for another char for
(window-list)
(list (selected-window))))
(with-selected-window win
(dolist (pair (avy--find-visible-regions
(window-start)
(window-end (selected-window) t)))
(save-excursion
(goto-char (window-start))
(goto-char (car pair))
(setq regex (regexp-quote str))
(while (re-search-forward regex (window-end) t)
(while (re-search-forward regex (cdr pair) t)
(unless (get-char-property (point) 'invisible)
(let ((ov (make-overlay (match-beginning 0) (match-end 0))))
(push ov overlays)
(overlay-put ov 'window (selected-window))
(overlay-put ov 'face 'avy-goto-char-timer-face)))))))))
(overlay-put ov 'face 'avy-goto-char-timer-face))))))))))
str)
(dolist (ov overlays)
(delete-overlay ov)))))
@ -1150,7 +1153,12 @@ read string immediately instead of waiting for another char for
"Read one or many consecutive chars and jump to the first one.
The window scope is determined by `avy-all-windows' (ARG negates it)."
(interactive "P")
(let ((str (avy--read-string-timer)))
(let ((str
(let ((avy-all-windows
(if arg
(not avy-all-windows)
avy-all-windows)))
(avy--read-string-timer))))
(avy-with avy-goto-char-timer
(avy--generic-jump
(regexp-quote str)