]> code.delx.au - gnu-emacs-elpa/commitdiff
Allow all kinds of styles for `avy-goto-line'
authorOleh Krehel <ohwoeowho@gmail.com>
Wed, 13 May 2015 22:05:28 +0000 (00:05 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Wed, 13 May 2015 22:05:28 +0000 (00:05 +0200)
* avy.el (avy--line): Use the custom style. Use line end postion for
  'post style.

Fixes abo-abo/ace-link#17

Any of the following do something different now:

(setq avy-styles-alist
      '((avy-goto-line . post)))
(setq avy-styles-alist
      '((avy-goto-line . at)))
(setq avy-styles-alist
      '((avy-goto-line . at-full)))
(setq avy-styles-alist
      '((avy-goto-line . pre)))

avy.el

diff --git a/avy.el b/avy.el
index 192f58b96fa32a89d4b10e44990a0f7644842998..42fe9934b1af5e9b4974ba3b2ae7aa3b26fe5f74 100644 (file)
--- a/avy.el
+++ b/avy.el
@@ -640,9 +640,13 @@ The window scope is determined by `avy-all-windows' (ARG negates it)."
             (while (< (point) (point-max))
               (unless (get-char-property
                        (max (1- (point)) ws) 'invisible)
-                (push (cons (point) (selected-window)) candidates))
+                (push (cons
+                       (if (eq avy-style 'post)
+                           (line-end-position)
+                         (line-beginning-position))
+                       (selected-window)) candidates))
               (forward-line 1))))))
-    (avy--process (nreverse candidates) #'avy--overlay-pre)))
+    (avy--process (nreverse candidates) (avy--style-fn avy-style))))
 
 ;;;###autoload
 (defun avy-goto-line (&optional arg)