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

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

[elpa] master 576563d 082/167: ivy.el (with-ivy-window): Ensure window i


From: Oleh Krehel
Subject: [elpa] master 576563d 082/167: ivy.el (with-ivy-window): Ensure window is live
Date: Tue, 08 Dec 2015 10:50:03 +0000

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

    ivy.el (with-ivy-window): Ensure window is live
    
    * ivy.el (ivy--get-window): New defun.
---
 ivy.el |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/ivy.el b/ivy.el
index b6c8b08..10c019d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -281,7 +281,7 @@ When non-nil, it should contain one %d.")
   "Execute BODY in the window from which `ivy-read' was called."
   (declare (indent 0)
            (debug t))
-  `(with-selected-window (ivy-state-window ivy-last)
+  `(with-selected-window (ivy--get-window ivy-last)
      ,@body))
 
 (defun ivy--done (text)
@@ -617,6 +617,15 @@ If the input is empty, select the previous history element 
instead."
           action
         (cadr (nth (car action) action))))))
 
+(defun ivy--get-window (state)
+  "Get the window from STATE."
+  (let ((window (ivy-state-window state)))
+    (if (window-live-p window)
+        window
+      (if (= (length (window-list)) 1)
+          (selected-window)
+        (next-window )))))
+
 (defun ivy--actionp (x)
   "Return non-nil when X is a list of actions."
   (and x (listp x) (not (eq (car x) 'closure))))



reply via email to

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