From 009c0bc1ed676ba2180bc6c722e0c06b8b17f26a Mon Sep 17 00:00:00 2001 From: Oleh Krehel Date: Fri, 21 Aug 2015 14:46:07 +0200 Subject: [PATCH] avy.el (avy--line): Work for visual-line-mode Use `point' instead of `line-beginning-position'. Fixes #91 --- avy.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/avy.el b/avy.el index 459d99f..2812703 100644 --- a/avy.el +++ b/avy.el @@ -909,6 +909,8 @@ Which one depends on variable `subword-mode'." (call-interactively #'avy-goto-subword-1) (call-interactively #'avy-goto-word-1))) +(defvar visual-line-mode) + (defun avy--line (&optional arg) "Select a line. The window scope is determined by `avy-all-windows' (ARG negates it)." @@ -926,9 +928,11 @@ The window scope is determined by `avy-all-windows' (ARG negates it)." (push (cons (if (eq avy-style 'post) (line-end-position) - (line-beginning-position)) + (point)) (selected-window)) candidates)) - (forward-line 1)))))) + (if visual-line-mode + (line-move 1) + (forward-line 1))))))) (setq avy-action #'identity) (avy--process (nreverse candidates) (avy--style-fn avy-style))))