emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 2c74d01 21/78: avy.el (avy--generic-jump): Add beg and end


From: Oleh Krehel
Subject: [elpa] master 2c74d01 21/78: avy.el (avy--generic-jump): Add beg and end optional args
Date: Sat, 23 Jan 2016 13:59:46 +0000

branch: master
commit 2c74d0160a52ecdf6a24ddf70230748a1dc40d01
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    avy.el (avy--generic-jump): Add beg and end optional args
    
    * avy.el (avy-goto-char-in-line): Update.
    
    Fixes #89
---
 avy.el |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/avy.el b/avy.el
index 7f1b7e7..459d99f 100644
--- a/avy.el
+++ b/avy.el
@@ -765,16 +765,17 @@ LEAF is normally ((BEG . END) . WND)."
     (de-bruijn #'avy--overlay-at-full)
     (t (error "Unexpected style %S" style))))
 
-(defun avy--generic-jump (regex window-flip style)
+(defun avy--generic-jump (regex window-flip style &optional beg end)
   "Jump to REGEX.
 When WINDOW-FLIP is non-nil, do the opposite of `avy-all-windows'.
-STYLE determines the leading char overlay style."
+STYLE determines the leading char overlay style.
+BEG and END delimit the area where candidates are searched."
   (let ((avy-all-windows
          (if window-flip
              (not avy-all-windows)
            avy-all-windows)))
     (avy--process
-     (avy--regex-candidates regex)
+     (avy--regex-candidates regex beg end)
      (avy--style-fn style))))
 
 ;;* Commands
@@ -796,14 +797,13 @@ The window scope is determined by `avy-all-windows' (ARG 
negates it)."
 (defun avy-goto-char-in-line (char)
   "Jump to the currently visible CHAR in the current line."
   (interactive (list (read-char "char: " t)))
-  (let ((avy-all-windows nil))
-    (avy-with avy-goto-char
-      (avy--process
-       (save-restriction
-         (narrow-to-region (line-beginning-position)
-                           (line-end-position))
-         (avy--regex-candidates (regexp-quote (string char))))
-       (avy--style-fn avy-style)))))
+  (avy-with avy-goto-char
+    (avy--generic-jump
+     (regexp-quote (string char))
+     avy-all-windows
+     avy-style
+     (line-beginning-position)
+     (line-end-position))))
 
 ;;;###autoload
 (defun avy-goto-char-2 (char1 char2 &optional arg)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]