avy.el (avy-all-windows-alt): New defcustom

* avy.el (avy-dowindows): Use `avy-all-windows-alt'.
(avy--regex-candidates):
(avy--read-candidates): Use `current-prefix-arg'. At some later point, it
could be passed as an argument instead.

Fixes #118
This commit is contained in:
Oleh Krehel 2015-12-07 10:36:01 +01:00
parent a45159a8ca
commit 54074c764d

12
avy.el
View File

@ -432,12 +432,18 @@ multiple DISPLAY-FN invokations."
(t (t
(error "Unrecognized option: %S" avy-all-windows)))) (error "Unrecognized option: %S" avy-all-windows))))
(defcustom avy-all-windows-alt t
"The alternative `avy-all-windows' for use with \\[universal-argument]."
:type '(choice
(const :tag "All windows on the current frame" t)
(const :tag "All windows on all frames" all-frames)))
(defmacro avy-dowindows (flip &rest body) (defmacro avy-dowindows (flip &rest body)
"Depending on FLIP and `avy-all-windows' run BODY in each or selected window." "Depending on FLIP and `avy-all-windows' run BODY in each or selected window."
(declare (indent 1) (declare (indent 1)
(debug (form body))) (debug (form body)))
`(let ((avy-all-windows (if ,flip `(let ((avy-all-windows (if ,flip
(not avy-all-windows) avy-all-windows-alt
avy-all-windows))) avy-all-windows)))
(dolist (wnd (avy-window-list)) (dolist (wnd (avy-window-list))
(with-selected-window wnd (with-selected-window wnd
@ -591,7 +597,7 @@ When GROUP is non-nil, (BEG . END) should delimit that regex group."
(let ((case-fold-search (or avy-case-fold-search (let ((case-fold-search (or avy-case-fold-search
(not (string= regex (upcase regex))))) (not (string= regex (upcase regex)))))
candidates) candidates)
(avy-dowindows nil (avy-dowindows current-prefix-arg
(dolist (pair (avy--find-visible-regions (dolist (pair (avy--find-visible-regions
(or beg (window-start)) (or beg (window-start))
(or end (window-end (selected-window) t)))) (or end (window-end (selected-window) t))))
@ -1208,7 +1214,7 @@ This function obeys `avy-all-windows' setting."
;; Highlight ;; Highlight
(when (>= (length str) 1) (when (>= (length str) 1)
(let (found) (let (found)
(avy-dowindows nil (avy-dowindows current-prefix-arg
(dolist (pair (avy--find-visible-regions (dolist (pair (avy--find-visible-regions
(window-start) (window-start)
(window-end (selected-window) t))) (window-end (selected-window) t)))