branch: master commit 08370cdbc35ff41646461a02d6d9758dfce30c20 Author: walseb <greatestmailofallt...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
Add option to limit avy-goto-subword-0 scope Fixes #235 --- avy.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/avy.el b/avy.el index bf82845..3fc645e 100644 --- a/avy.el +++ b/avy.el @@ -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)