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

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

[elpa] master 2bc08de 07/12: Merge ivy--persistent-action into ivy-state


From: Oleh Krehel
Subject: [elpa] master 2bc08de 07/12: Merge ivy--persistent-action into ivy-state-action
Date: Sun, 03 May 2015 11:04:54 +0000

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

    Merge ivy--persistent-action into ivy-state-action
    
    * counsel.el (counsel-git-grep): Update.
    
    * ivy.el (ivy--persistent-action): Remove defvar.
    (ivy-next-line-and-call): Update.
    (ivy-previous-line-and-call): Update.
---
 counsel.el |   25 ++++++++++++-------------
 ivy.el     |   13 ++++---------
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/counsel.el b/counsel.el
index daa05b9..7ee63fc 100644
--- a/counsel.el
+++ b/counsel.el
@@ -215,19 +215,18 @@
                                       default-directory ".git"))
               (counsel--git-grep-count (counsel-git-grep-count ""))
               (ivy--dynamic-function (when (> counsel--git-grep-count 20000)
-                                       'counsel-git-grep-function))
-              (ivy--persistent-action (lambda (x)
-                                        (let ((lst (split-string x ":")))
-                                          (find-file (expand-file-name (car 
lst) counsel--git-grep-dir))
-                                          (goto-char (point-min))
-                                          (forward-line (1- (string-to-number 
(cadr lst))))
-                                          (setq swiper--window 
(selected-window))
-                                          (swiper--cleanup)
-                                          (swiper--add-overlays (ivy--regex 
ivy-text)))))
-              (val (ivy-read "pattern: " 'counsel-git-grep-function
-                             :initial-input initial-input)))
-         (when val
-           (funcall ivy--persistent-action val)))
+                                       'counsel-git-grep-function)))
+         (ivy-read "pattern: " 'counsel-git-grep-function
+                   :initial-input initial-input
+                   :action
+                   (lambda ()
+                     (let ((lst (split-string ivy--current ":")))
+                       (find-file (expand-file-name (car lst) 
counsel--git-grep-dir))
+                       (goto-char (point-min))
+                       (forward-line (1- (string-to-number (cadr lst))))
+                       (setq swiper--window (selected-window))
+                       (swiper--cleanup)
+                       (swiper--add-overlays (ivy--regex ivy-text))))))
     (swiper--cleanup)))
 
 (defun counsel-locate-function (str &rest _u)
diff --git a/ivy.el b/ivy.el
index 49568d5..05509f8 100644
--- a/ivy.el
+++ b/ivy.el
@@ -157,9 +157,6 @@ of `history-length', which see.")
   "Store 'done if the completion was successfully selected.
 Otherwise, store nil.")
 
-(defvar ivy--persistent-action nil
-  "Store a function to call for current candidate without exiting.")
-
 (defvar ivy--all-candidates nil
   "Store the candidates passed to `ivy-read'.")
 
@@ -378,18 +375,16 @@ If the input is empty, select the previous history 
element instead."
   (interactive "p")
   (ivy-next-line arg)
   (ivy--exhibit)
-  (when ivy--persistent-action
-    (with-selected-window (ivy-state-window ivy-last)
-      (funcall ivy--persistent-action ivy--current))))
+  (with-selected-window (ivy-state-window ivy-last)
+    (funcall (ivy-state-action ivy-last))))
 
 (defun ivy-previous-line-and-call (&optional arg)
   "Move cursor vertically down ARG candidates."
   (interactive "p")
   (ivy-previous-line arg)
   (ivy--exhibit)
-  (when ivy--persistent-action
-    (with-selected-window (ivy-state-window ivy-last)
-      (funcall ivy--persistent-action ivy--current))))
+  (with-selected-window (ivy-state-window ivy-last)
+    (funcall (ivy-state-action ivy-last))))
 
 (defun ivy-previous-history-element (arg)
   "Forward to `previous-history-element' with ARG."



reply via email to

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