[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e802510 098/110: avy.el (avy-jump): New API, don't use avy
From: |
Oleh Krehel |
Subject: |
[elpa] master e802510 098/110: avy.el (avy-jump): New API, don't use avy--generic-jump |
Date: |
Sat, 11 May 2019 10:15:53 -0400 (EDT) |
branch: master
commit e80251056de24ef67b12d4e81f5aba45d3719c7c
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
avy.el (avy-jump): New API, don't use avy--generic-jump
Fixes #265
---
avy.el | 48 ++++++++++++++++++++++++++++++++++--------------
1 file changed, 34 insertions(+), 14 deletions(-)
diff --git a/avy.el b/avy.el
index 1bf57c1..372d608 100644
--- a/avy.el
+++ b/avy.el
@@ -1200,11 +1200,26 @@ exist."
(ignore #'ignore)
(t (error "Unexpected style %S" style))))
+(cl-defun avy-jump (regex &key window-flip beg end action)
+ "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."
+ (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))))
+
(defun avy--generic-jump (regex window-flip &optional beg end)
"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."
+ (declare (obsolete avy-jump "0.4.0"))
(let ((avy-all-windows
(if window-flip
(not avy-all-windows)
@@ -1220,22 +1235,21 @@ The window scope is determined by `avy-all-windows'
(ARG negates it)."
(interactive (list (read-char "char: " t)
current-prefix-arg))
(avy-with avy-goto-char
- (avy--generic-jump
+ (avy-jump
(if (= 13 char)
"\n"
(regexp-quote (string char)))
- arg)))
+ :window-flip arg)))
;;;###autoload
(defun avy-goto-char-in-line (char)
"Jump to the currently visible CHAR in the current line."
(interactive (list (read-char "char: " t)))
(avy-with avy-goto-char
- (avy--generic-jump
+ (avy-jump
(regexp-quote (string char))
- avy-all-windows
- (line-beginning-position)
- (line-end-position))))
+ :beg (line-beginning-position)
+ :end (line-end-position))))
;;;###autoload
(defun avy-goto-char-2 (char1 char2 &optional arg beg end)
@@ -1252,10 +1266,11 @@ BEG and END narrow the scope where candidates are
searched."
(when (eq char2 ?
)
(setq char2 ?\n))
(avy-with avy-goto-char-2
- (avy--generic-jump
+ (avy-jump
(regexp-quote (string char1 char2))
- arg
- beg end)))
+ :window-flip arg
+ :beg beg
+ :end end)))
;;;###autoload
(defun avy-goto-char-2-above (char1 char2 &optional arg)
@@ -1307,7 +1322,10 @@ 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-word-0
- (avy--generic-jump avy-goto-word-0-regexp arg beg end)))
+ (avy-jump avy-goto-word-0-regexp
+ :window-flip arg
+ :beg beg
+ :end end)))
(defun avy-goto-word-0-above (arg)
"Jump to a word start between window start and point.
@@ -1347,7 +1365,10 @@ When SYMBOL is non-nil, jump to symbol start instead of
word start."
(concat
(if symbol "\\_<" "\\b")
str)))))
- (avy--generic-jump regex arg beg end))))
+ (avy-jump regex
+ :window-flip arg
+ :beg beg
+ :end end))))
;;;###autoload
(defun avy-goto-word-1-above (char &optional arg)
@@ -2064,9 +2085,8 @@ The window scope is determined by `avy-all-windows' (ARG
negates it)."
(let* ((org-reverse-note-order t)
(marker (save-excursion
(avy-with avy-goto-line
- (unless (eq 't (avy--generic-jump (rx bol (1+ "*") (1+
space))
- nil))
- ;; `avy--generic-jump' returns t when aborted with C-g.
+ (unless (eq 't (avy-jump (rx bol (1+ "*") (1+ space))))
+ ;; `avy-jump' returns t when aborted with C-g.
(point-marker)))))
(filename (buffer-file-name (or (buffer-base-buffer (marker-buffer
marker))
(marker-buffer marker))))
- [elpa] master 4d52b5c 105/110: avy.el (avy--line-cands): Allow "invisible" 'org-link, (continued)
- [elpa] master 4d52b5c 105/110: avy.el (avy--line-cands): Allow "invisible" 'org-link, Oleh Krehel, 2019/05/11
- [elpa] master e9f4d85 092/110: avy.el (avy-goto-char-timer): Obey avy-background for initial search, Oleh Krehel, 2019/05/11
- [elpa] master 9124022 097/110: avy.el (avy--generic-jump): Update docstring about removed arg, Oleh Krehel, 2019/05/11
- [elpa] master b19a23a 096/110: avy.el (avy--visible-p): buffer-invisibility-spec can be t, Oleh Krehel, 2019/05/11
- [elpa] master 118a3d6 093/110: Update readme.md: add melpa badges, Oleh Krehel, 2019/05/11
- [elpa] master 9a15d1f 103/110: avy.el (avy-show-dispatch-help): Add and bind to "?", Oleh Krehel, 2019/05/11
- [elpa] master 74501e1 094/110: avy.el: More fixes to org-toggle-link-display, Oleh Krehel, 2019/05/11
- [elpa] master 8db2759 099/110: Change avy--process to accept cleanup function, Oleh Krehel, 2019/05/11
- [elpa] master 7d73cee 100/110: avy.el: Use avy-process instead of avy--process, Oleh Krehel, 2019/05/11
- [elpa] master fd0101e 101/110: avy.el (avy-push-mark): Turn off message, Oleh Krehel, 2019/05/11
- [elpa] master e802510 098/110: avy.el (avy-jump): New API, don't use avy--generic-jump,
Oleh Krehel <=
- [elpa] master 7cfe11e 074/110: Added ability to display avy candidates from bottom to top, Oleh Krehel, 2019/05/11
- [elpa] master 8606a89 072/110: avy.el (avy--process): Remove redundant copy-sequence, Oleh Krehel, 2019/05/11
- [elpa] master 002b8f3 091/110: avy.el (avy--visible-p): Add to fix org-toggle-link-display, Oleh Krehel, 2019/05/11
- [elpa] master 16482e0 089/110: avy.el (avy--generic-jump): Remove `style' arg, Oleh Krehel, 2019/05/11
- [elpa] master 909483e 090/110: avy.el (avy--process): Make `overlay-fn' arg optional, Oleh Krehel, 2019/05/11
- [elpa] master 24b5137 087/110: Ignore mistyping when no candidates available, Oleh Krehel, 2019/05/11
- [elpa] master c4e2d50 077/110: avy.el: avy-goto-char will now display shortest overlays for cands near point, Oleh Krehel, 2019/05/11
- [elpa] master 1de6233 076/110: Add avy-goto-end-of-line, Oleh Krehel, 2019/05/11
- [elpa] master c2e2a4a 083/110: avy.el (avy--read-candidates): Custom keys for deleting last read char, Oleh Krehel, 2019/05/11
- [elpa] master 4f1b8a1 086/110: avy.el: Fix compiler warnings, Oleh Krehel, 2019/05/11