branch: elpa/helm
commit 5d1c0781d8af356ed5e45c7c48ab3ceb8a33e9a9
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    Fix window error when current-buffer has been killed in current session
---
 helm-files.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/helm-files.el b/helm-files.el
index a391e71be4..3282905572 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -1041,7 +1041,11 @@ directories belonging to each visible windows."
 
 (defun helm-dwim-target-directory ()
   "Try to return a suitable directory according to `helm-dwim-target'."
-  (with-selected-window (get-buffer-window helm-current-buffer)
+  (with-selected-window (or
+                         ;; Try next-window if current-buffer has been
+                         ;; killed during this session probably by C-d.
+                         (get-buffer-window helm-current-buffer)
+                         (next-window (helm-window) 1))
     (let ((wins (remove (get-buffer-window helm-marked-buffer-name)
                         (window-list))))
       (expand-file-name

Reply via email to