Add option to limit avy-goto-subword-0 scope

Fixes #235
This commit is contained in:
walseb 2018-04-15 21:25:54 +02:00 committed by Oleh Krehel
parent 2d613eb050
commit 08370cdbc3

7
avy.el
View File

@ -1341,10 +1341,11 @@ This variable is used by `avy-goto-subword-0' and `avy-goto-subword-1'."
:type '(repeat character))
;;;###autoload
(defun avy-goto-subword-0 (&optional arg predicate)
(defun avy-goto-subword-0 (&optional arg predicate beg end)
"Jump to a word or subword start.
The window scope is determined by `avy-all-windows' (ARG negates it).
BEG and END narrow the scope where candidates are searched.
When PREDICATE is non-nil it's a function of zero parameters that
should return true."
@ -1360,10 +1361,10 @@ should return true."
(dolist (char avy-subword-extra-word-chars)
(modify-syntax-entry char "w" syn-tbl))
(with-syntax-table syn-tbl
(let ((ws (window-start))
(let ((ws (or beg (window-start)))
window-cands)
(save-excursion
(goto-char (window-end (selected-window) t))
(goto-char (or end (window-end (selected-window) t)))
(subword-backward)
(while (> (point) ws)
(when (or (null predicate)