]> code.delx.au - gnu-emacs-elpa/commitdiff
avy.el (avy--overlay-at-full): Fixup (for overlays-in)
authorOleh Krehel <ohwoeowho@gmail.com>
Mon, 15 Jun 2015 14:17:58 +0000 (16:17 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 15 Jun 2015 14:17:58 +0000 (16:17 +0200)
* avy.el (avy--overlay-at-full): Account for `overlays-in' not being
  returned in the buffer order sometimes: it seems to be random order.
  Instead, look at the minimum of all overlay starts that are on the
  current line.

Fixes #52.

avy.el

diff --git a/avy.el b/avy.el
index 01acb2c49645264534041589f8e81c11d83cf9f9..0caeb8a6f1b6614158c4a1fa32b1c29646630481 100644 (file)
--- a/avy.el
+++ b/avy.el
@@ -596,12 +596,16 @@ LEAF is normally ((BEG . END) . WND)."
     (with-selected-window wnd
       (save-excursion
         (goto-char beg)
-        (when (setq oov (cl-find-if (lambda (o)
-                                      (and (eq (overlay-get o 'category) 'avy)
-                                           (eq (overlay-get o 'window) wnd)))
-                                    (overlays-in (point) (min (+ (point) len)
-                                                              (line-end-position)))))
-          (setq len (- (overlay-start oov) beg))
+        (when (setq oov
+                    (delq nil
+                          (mapcar
+                           (lambda (o)
+                             (and (eq (overlay-get o 'category) 'avy)
+                                  (eq (overlay-get o 'window) wnd)
+                                  (overlay-start o)))
+                           (overlays-in (point) (min (+ (point) len)
+                                                     (line-end-position))))))
+          (setq len (- (apply #'min oov) beg))
           (setq str (substring str 0 len)))
         (let ((other-ov (cl-find-if
                          (lambda (o)