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

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

[elpa] master 64759ec 4/6: avy-jump.el (avi--overlay-offset): Add


From: Oleh Krehel
Subject: [elpa] master 64759ec 4/6: avy-jump.el (avi--overlay-offset): Add
Date: Thu, 16 Apr 2015 12:13:06 +0000

branch: master
commit 64759ec02ea0e02c7ec549be084b17050c990096
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    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)))



reply via email to

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