[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 3257d81 49/78: Add avy-candidate-* helper functions
From: |
Oleh Krehel |
Subject: |
[elpa] master 3257d81 49/78: Add avy-candidate-* helper functions |
Date: |
Sat, 23 Jan 2016 14:00:08 +0000 |
branch: master
commit 3257d81b4a513ae4e963015f685aa9be5144f7a2
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add avy-candidate-* helper functions
* avy.el (avy-candidate-beg):
(avy-candidate-end):
(avy-candidate-wnd): New defun.
(avy--overlay-pre):
(avy--overlay-at):
(avy--overlay-at-full):
(avy--overlay-post): Update.
---
avy.el | 55 ++++++++++++++++++++++++++++++-------------------------
1 files changed, 30 insertions(+), 25 deletions(-)
diff --git a/avy.el b/avy.el
index 2bbbfe6..61dac3a 100644
--- a/avy.el
+++ b/avy.el
@@ -649,6 +649,30 @@ Do this even when the char is terminating."
(or (cdr (assoc c avy-key-to-char-alist))
(error "Unknown key %s" c))))
+(defun avy-candidate-beg (leaf)
+ "Return the start position for LEAF."
+ (cond ((numberp leaf)
+ leaf)
+ ((consp (car leaf))
+ (caar leaf))
+ (t
+ (car leaf))))
+
+(defun avy-candidate-end (leaf)
+ "Return the end position for LEAF."
+ (cond ((numberp leaf)
+ leaf)
+ ((consp (car leaf))
+ (cdar leaf))
+ (t
+ (car leaf))))
+
+(defun avy-candidate-wnd (leaf)
+ "Return the window for LEAF."
+ (if (consp leaf)
+ (cdr leaf)
+ (selected-window)))
+
(defun avy--overlay-pre (path leaf)
"Create an overlay with PATH at LEAF.
PATH is a list of keys from tree root to LEAF.
@@ -664,15 +688,8 @@ LEAF is normally ((BEG . END) . WND)."
str))
(avy--overlay
str
- (cond ((numberp leaf)
- leaf)
- ((consp (car leaf))
- (caar leaf))
- (t
- (car leaf)))
- (if (consp leaf)
- (cdr leaf)
- (selected-window)))))
+ (avy-candidate-beg leaf)
+ (avy-candidate-wnd leaf))))
(defun avy--overlay-at (path leaf)
"Create an overlay with PATH at LEAF.
@@ -682,10 +699,7 @@ LEAF is normally ((BEG . END) . WND)."
(str (propertize
(string (car (last path)))
'face 'avy-lead-face))
- (pt (+ (if (consp (car leaf))
- (caar leaf)
- (car leaf))
- avy--overlay-offset))
+ (pt (+ (avy-candidate-beg leaf) avy--overlay-offset))
(wnd (cdr leaf))
(ol (make-overlay pt (1+ pt) (window-buffer wnd)))
(old-str (avy--old-str pt wnd)))
@@ -707,9 +721,7 @@ LEAF is normally ((BEG . END) . WND)."
(apply #'string (reverse path))
'face 'avy-lead-face))
(len (length path))
- (beg (if (consp (car leaf))
- (caar leaf)
- (car leaf)))
+ (beg (avy-candidate-beg leaf))
(wnd (cdr leaf))
oov)
(dotimes (i len)
@@ -791,15 +803,8 @@ LEAF is normally ((BEG . END) . WND)."
str))
(avy--overlay
str
- (cond ((numberp leaf)
- leaf)
- ((consp (car leaf))
- (cdar leaf))
- (t
- (car leaf)))
- (if (consp leaf)
- (cdr leaf)
- (selected-window)))))
+ (avy-candidate-end leaf)
+ (avy-candidate-wnd leaf))))
(defun avy--style-fn (style)
"Transform STYLE symbol to a style function."
- [elpa] master 528125e 40/78: avy.el (avy--process): Add window to candidates if not present, (continued)
- [elpa] master 528125e 40/78: avy.el (avy--process): Add window to candidates if not present, Oleh Krehel, 2016/01/23
- [elpa] master df181f1 44/78: avy.el (avy--read-candidates): Use avy-window-list, Oleh Krehel, 2016/01/23
- [elpa] master 964664c 45/78: Fix jumping to the last char of a folded Org outline, Oleh Krehel, 2016/01/23
- [elpa] master 0a18a45 43/78: avy.el (avy--read-candidates): Fix reverse order, Oleh Krehel, 2016/01/23
- [elpa] master 513c429 41/78: Make avy-goto-char-timer faster for org-mode, Oleh Krehel, 2016/01/23
- [elpa] master f28d238 46/78: Fix for combined org-indent-mode and visual-line-mode, Oleh Krehel, 2016/01/23
- [elpa] master 2313410 42/78: Optimize avy-goto-char-timer, Oleh Krehel, 2016/01/23
- [elpa] master 0166808 47/78: Beep when there are no matches, Oleh Krehel, 2016/01/23
- [elpa] master 2d07a49 50/78: Make avy--overlay-at use avy--overlay, Oleh Krehel, 2016/01/23
- [elpa] master cf36a59 48/78: avy.el (avy--old-str): New defun., Oleh Krehel, 2016/01/23
- [elpa] master 3257d81 49/78: Add avy-candidate-* helper functions,
Oleh Krehel <=
- [elpa] master 13377d9 51/78: avy.el (avy--update-offset-and-str): Split from avy--overlay-at-full, Oleh Krehel, 2016/01/23
- [elpa] master d4b693f 52/78: avy.el (avy--overlay): Take BEG END, instead of only BEG, Oleh Krehel, 2016/01/23
- [elpa] master 567570a 54/78: Fix 'at-full moving text when visual-line-mode is on, Oleh Krehel, 2016/01/23
- [elpa] master 0756c0b 53/78: avy.el (avy--overlay-at-full): Use avy--overlay, Oleh Krehel, 2016/01/23
- [elpa] master 1b78fb0 57/78: Improve the faces for the last change, Oleh Krehel, 2016/01/23
- [elpa] master dddce37 55/78: Fix 'at-full moving text for chars near end of visual line, Oleh Krehel, 2016/01/23
- [elpa] master edf1259 58/78: avy.el (avy--read-candidates): Use avy-dowindows, Oleh Krehel, 2016/01/23
- [elpa] master 9ae4413 56/78: Fix overlays at end-of-line with visual-line-mode, Oleh Krehel, 2016/01/23
- [elpa] master f341c2f 59/78: avy.el (avy--find-visible-regions): Add bounds safety, Oleh Krehel, 2016/01/23
- [elpa] master a041429 62/78: avy.el (avy-copy-region): Obey avy-line-insert-style, Oleh Krehel, 2016/01/23