branch: elpa/helm
commit 4b1f03e79c09f2e669cd0f7a2fd4d88022ebc8f2
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>
Ensure helm-dwim-target-directories doesn't return nil
remove possible dups as well.
---
helm-files.el | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/helm-files.el b/helm-files.el
index 88dcaf80cb1..66709a107db 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -1244,9 +1244,17 @@ Used when showing tramp host completions."
(defun helm-dwim-target-directories ()
"Provide a list of default targets for `helm-find-files' actions."
- (cl-loop for w in helm-initial-windows collect
- (with-selected-window w default-directory) into lst
- finally return (delete helm-ff-default-directory lst)))
+ (cl-loop for w in helm-initial-windows
+ for dir = (with-selected-window w default-directory)
+ unless (member dir dirs)
+ collect dir into dirs
+ ;; Prevent having helm-ff-default-directory in defaults while we are
+ ;; already in it, if it is the only member of list return this list
+ ;; to prevent helm using the thing-at-point in *helm marked* buffer
+ ;; which is irrelevant.
+ finally return (if (cdr dirs)
+ (delete helm-ff-default-directory dirs)
+ dirs)))
(defun helm-dwim-target-directory ()
"Try to return a suitable directory according to `helm-dwim-target'."