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

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

[elpa] master d1780dd 07/17: avy-jump.el (avi-goto-line): Work with one


From: Oleh Krehel
Subject: [elpa] master d1780dd 07/17: avy-jump.el (avi-goto-line): Work with one or more windows
Date: Fri, 08 May 2015 13:43:40 +0000

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

    avy-jump.el (avi-goto-line): Work with one or more windows
    
    * avy-jump.el (avi-goto-line): Update.
    (avi--line): Update.
---
 avy-jump.el |   38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/avy-jump.el b/avy-jump.el
index 2ed91db..c65c63a 100644
--- a/avy-jump.el
+++ b/avy-jump.el
@@ -254,28 +254,36 @@ Read one char with which the word should start."
     (avi--goto
      (avi--process candidates #'avi--overlay-pre))))
 
-(defun avi--line ()
+(defun avi--line (&optional arg)
   "Select line in current window."
   (let ((avi-background nil)
-        (ws (window-start))
+        (avi-all-windows
+         (if arg
+             (not avi-all-windows)
+           avi-all-windows))
         candidates)
-    (save-excursion
-      (save-restriction
-        (narrow-to-region ws (window-end (selected-window) t))
-        (goto-char (point-min))
-        (while (< (point) (point-max))
-          (unless (get-char-property
-                   (max (1- (point)) ws) 'invisible)
-            (push (cons (point) (selected-window))
-                  candidates))
-          (forward-line 1))))
+    (dolist (wnd (if avi-all-windows
+                     (window-list)
+                   (list (selected-window))))
+      (with-selected-window wnd
+        (let ((ws (window-start)))
+          (save-excursion
+            (save-restriction
+              (narrow-to-region ws (window-end (selected-window) t))
+              (goto-char (point-min))
+              (while (< (point) (point-max))
+                (unless (get-char-property
+                         (max (1- (point)) ws) 'invisible)
+                  (push (cons (point) (selected-window))
+                        candidates))
+                (forward-line 1)))))))
     (avi--process (nreverse candidates) #'avi--overlay-pre)))
 
 ;;;###autoload
-(defun avi-goto-line ()
+(defun avi-goto-line (&optional arg)
   "Jump to a line start in current buffer."
-  (interactive)
-  (avi--goto (avi--line)))
+  (interactive "P")
+  (avi--goto (avi--line arg)))
 
 ;;;###autoload
 (defun avi-copy-line (arg)



reply via email to

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