[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/avy 27d1af3fa6 08/31: avy.el (avy-goto-whitespace-end):
From: |
ELPA Syncer |
Subject: |
[elpa] externals/avy 27d1af3fa6 08/31: avy.el (avy-goto-whitespace-end): New command |
Date: |
Mon, 13 Feb 2023 21:57:24 -0500 (EST) |
branch: externals/avy
commit 27d1af3fa6b7622a36452cddca1710e9d5245cf9
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
avy.el (avy-goto-whitespace-end): New command
* avy.el (avy--regex-candidates): Allow `group' to be a function.
(avy-jump): Pass `group' to `avy--regex-candidates'.
Fixes #278
---
avy.el | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/avy.el b/avy.el
index 7c33b983c9..b83fb29b1e 100644
--- a/avy.el
+++ b/avy.el
@@ -960,9 +960,12 @@ When GROUP is non-nil, (BEG . END) should delimit that
regex group."
(when (avy--visible-p (1- (point)))
(when (or (null pred)
(funcall pred))
- (push (cons (cons (match-beginning group)
- (match-end group))
- wnd) candidates)))))))
+ (push (cons
+ (if (numberp group)
+ (cons (match-beginning group)
+ (match-end group))
+ (funcall group))
+ wnd) candidates)))))))
(nreverse candidates)))
(defvar avy--overlay-offset 0
@@ -1233,20 +1236,22 @@ exist."
(ignore #'ignore)
(t (error "Unexpected style %S" style))))
-(cl-defun avy-jump (regex &key window-flip beg end action pred)
+(cl-defun avy-jump (regex &key window-flip beg end action pred group)
"Jump to REGEX.
The window scope is determined by `avy-all-windows'.
When WINDOW-FLIP is non-nil, do the opposite of `avy-all-windows'.
BEG and END narrow the scope where candidates are searched.
ACTION is a function that takes point position as an argument.
-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, it's either a match group in REGEX, or a function
+that returns a cons of match beginning and end."
(setq avy-action (or action avy-action))
(let ((avy-all-windows
(if window-flip
(not avy-all-windows)
avy-all-windows)))
(avy-process
- (avy--regex-candidates regex beg end pred))))
+ (avy--regex-candidates regex beg end pred group))))
(defun avy--generic-jump (regex window-flip &optional beg end)
"Jump to REGEX.
@@ -1361,6 +1366,20 @@ BEG and END narrow the scope where candidates are
searched."
:beg beg
:end end)))
+;;;###autoload
+(defun avy-goto-whitespace-end (arg &optional beg end)
+ "Jump to the end of a whitespace sequence.
+The window scope is determined by `avy-all-windows'.
+When ARG is non-nil, do the opposite of `avy-all-windows'.
+BEG and END narrow the scope where candidates are searched."
+ (interactive "P")
+ (avy-with avy-goto-whitespace-end
+ (avy-jump "[ \t]+\\|\n[ \t]*"
+ :window-flip arg
+ :beg beg
+ :end end
+ :group (lambda () (cons (point) (1+ (point)))))))
+
(defun avy-goto-word-0-above (arg)
"Jump to a word start between window start and point.
The window scope is determined by `avy-all-windows'.
- [elpa] externals/avy 01a311ca6a 07/31: avy.el: Get rid of magic char numbers, (continued)
- [elpa] externals/avy 01a311ca6a 07/31: avy.el: Get rid of magic char numbers, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 509471bad0 19/31: avy.el (avy-text): Store the avy-goto-char-timer text, ELPA Syncer, 2023/02/13
- [elpa] externals/avy bbf1e7339e 24/31: avy.el (avy-order-closest): Work with avy-goto-line, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 9ae059deaa 04/31: .github/FUNDING.yml: Add, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 343fc42de1 05/31: avy.el (avy-process): Return nil on "C-g" and "ESC", ELPA Syncer, 2023/02/13
- [elpa] externals/avy f91ae613a8 02/31: avy.el (avy-goto-line): Call avy-action-goto only when avy-action is not set, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 87394c9a88 13/31: avy.el (avy-isearch): Return relevant result, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 5127f993f9 10/31: avy.el (avy-process): Restart on fail for avy-style 'words, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 66886e265c 06/31: avy.el (avy-read): Don't call `avy--key-to-char' too early, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 8686845ed9 01/31: avy.el (avy-flyspell-correct-function): Add, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 27d1af3fa6 08/31: avy.el (avy-goto-whitespace-end): New command,
ELPA Syncer <=
- [elpa] externals/avy cf95ba9582 15/31: avy.el (avy-with): Fix typo in doc-string, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 954774d6e9 17/31: avy.el (avy-action-yank-line): Add and bind to "Y", ELPA Syncer, 2023/02/13
- [elpa] externals/avy 3bf83140fa 16/31: avy.el (avy-goto-line): Can cancel with ESC, ELPA Syncer, 2023/02/13
- [elpa] externals/avy aa35412375 18/31: avy.el (avy--line-cands): Don't set temporary-goal-column, ELPA Syncer, 2023/02/13
- [elpa] externals/avy f34ff764aa 22/31: avy.el (avy-escape-chars): Add defcustom, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 2dde8b71a0 23/31: avy.el (avy-process): Add autoload, ELPA Syncer, 2023/02/13
- [elpa] externals/avy e92cb37457 25/31: avy.el (avy-transpose-lines-in-region): Add, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 6b53033883 26/31: Add GNU ELPA badge to README.md, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 955c8dedd6 30/31: avy.el (avy--overlay): Avoid error on empty string, ELPA Syncer, 2023/02/13
- [elpa] externals/avy 9b1f0bc427 31/31: Merge remote-tracking branch 'refs/remotes/upstream/avy/main' into elpa--merge/avy, ELPA Syncer, 2023/02/13