branch: master
commit 64759ec02ea0e02c7ec549be084b17050c990096
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
avy-jump.el (avi--overlay-offset): Add
* avy-jump.el (avi--overlay-offset): New defvar.
(avi--overlay): Use `avi--overlay-offset'. Bind it for better
flexibility.
For instance, the regex can be "[^ a-z][a-z]+". In that case, it might
be desirable to shift the overlay by one char.
---
avy-jump.el | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/avy-jump.el b/avy-jump.el
index 9503ee9..50c7fce 100644
--- a/avy-jump.el
+++ b/avy-jump.el
@@ -94,11 +94,15 @@ When PRED is non-nil, it's a filter for matching point
positions."
wnd) candidates))))
(nreverse candidates))))
+(defvar avi--overlay-offset 0
+ "The offset to apply in `avi--overlay'.")
+
(defun avi--overlay (str pt wnd)
"Create an overlay with STR at PT in WND."
- (let ((ol (make-overlay pt (1+ pt) (window-buffer wnd)))
- (old-str (with-selected-window wnd
- (buffer-substring pt (1+ pt)))))
+ (let* ((pt (+ pt avi--overlay-offset))
+ (ol (make-overlay pt (1+ pt) (window-buffer wnd)))
+ (old-str (with-selected-window wnd
+ (buffer-substring pt (1+ pt)))))
(when avi-background
(setq old-str (propertize
old-str 'face 'aw-background-face)))