mirror of
https://github.com/abo-abo/avy.git
synced 2025-10-14 05:43:04 +00:00
avy.el (avy--regex-candidates): Add optional group arg
This commit is contained in:
parent
ca69b1f5a0
commit
eed8f6fa8b
10
avy.el
10
avy.el
@ -313,10 +313,12 @@ Use OVERLAY-FN to visualize the decision overlay."
|
|||||||
(setq avy--overlays-back nil)
|
(setq avy--overlays-back nil)
|
||||||
(avy--remove-leading-chars))
|
(avy--remove-leading-chars))
|
||||||
|
|
||||||
(defun avy--regex-candidates (regex &optional beg end pred)
|
(defun avy--regex-candidates (regex &optional beg end pred group)
|
||||||
"Return all elements that match REGEX.
|
"Return all elements that match REGEX.
|
||||||
Each element of the list is ((BEG . END) . WND)
|
Each element of the list is ((BEG . END) . WND)
|
||||||
When PRED is non-nil, it's a filter for matching point positions."
|
When PRED is non-nil, it's a filter for matching point positions.
|
||||||
|
When GROUP is non-nil, (BEG . END) should delimit that regex group."
|
||||||
|
(setq group (or group 0))
|
||||||
(let ((case-fold-search avy-case-fold-search)
|
(let ((case-fold-search avy-case-fold-search)
|
||||||
candidates)
|
candidates)
|
||||||
(avy-dowindows nil
|
(avy-dowindows nil
|
||||||
@ -327,8 +329,8 @@ When PRED is non-nil, it's a filter for matching point positions."
|
|||||||
(unless (get-char-property (point) 'invisible)
|
(unless (get-char-property (point) 'invisible)
|
||||||
(when (or (null pred)
|
(when (or (null pred)
|
||||||
(funcall pred))
|
(funcall pred))
|
||||||
(push (cons (cons (match-beginning 0)
|
(push (cons (cons (match-beginning group)
|
||||||
(match-end 0))
|
(match-end group))
|
||||||
wnd) candidates)))))))
|
wnd) candidates)))))))
|
||||||
(nreverse candidates)))
|
(nreverse candidates)))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user