avy.el (avy-goto-char-2-above): Simplify

* avy.el (avy-goto-char-2): Add BEG and END.
(avy-goto-char-2-below): Simplify.
This commit is contained in:
Oleh Krehel 2016-05-18 08:39:11 +02:00
parent ba950a0ad5
commit d644be1399

30
avy.el
View File

@ -963,17 +963,19 @@ The window scope is determined by `avy-all-windows' (ARG negates it)."
(line-end-position)))) (line-end-position))))
;;;###autoload ;;;###autoload
(defun avy-goto-char-2 (char1 char2 &optional arg) (defun avy-goto-char-2 (char1 char2 &optional arg beg end)
"Jump to the currently visible CHAR1 followed by CHAR2. "Jump to the currently visible CHAR1 followed by CHAR2.
The window scope is determined by `avy-all-windows' (ARG negates it)." The window scope is determined by `avy-all-windows' (ARG negates it)."
(interactive (list (read-char "char 1: " t) (interactive (list (read-char "char 1: " t)
(read-char "char 2: " t) (read-char "char 2: " t)
current-prefix-arg)) current-prefix-arg
nil nil))
(avy-with avy-goto-char-2 (avy-with avy-goto-char-2
(avy--generic-jump (avy--generic-jump
(regexp-quote (string char1 char2)) (regexp-quote (string char1 char2))
arg arg
avy-style))) avy-style
beg end)))
;;;###autoload ;;;###autoload
(defun avy-goto-char-2-above (char1 char2 &optional arg) (defun avy-goto-char-2-above (char1 char2 &optional arg)
@ -983,13 +985,10 @@ the visible part of the current buffer up to point."
(interactive (list (read-char "char 1: " t) (interactive (list (read-char "char 1: " t)
(read-char "char 2: " t) (read-char "char 2: " t)
current-prefix-arg)) current-prefix-arg))
(avy-with avy-goto-char-2 (avy-with avy-goto-char-2-above
(avy--generic-jump (avy-goto-char-2
(regexp-quote (string char1 char2)) char1 char2 arg
arg (window-start) (point))))
avy-style
(window-start (selected-window))
(point))))
;;;###autoload ;;;###autoload
(defun avy-goto-char-2-below (char1 char2 &optional arg) (defun avy-goto-char-2-below (char1 char2 &optional arg)
@ -999,13 +998,10 @@ the visible part of the current buffer following point."
(interactive (list (read-char "char 1: " t) (interactive (list (read-char "char 1: " t)
(read-char "char 2: " t) (read-char "char 2: " t)
current-prefix-arg)) current-prefix-arg))
(avy-with avy-goto-char-2 (avy-with avy-goto-char-2-below
(avy--generic-jump (avy-goto-char-2
(regexp-quote (string char1 char2)) char1 char2 arg
arg (point) (window-end (selected-window) t))))
avy-style
(point)
(window-end (selected-window) t))))
;;;###autoload ;;;###autoload
(defun avy-isearch () (defun avy-isearch ()