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

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

[nongnu] elpa/helm 49647d3f54 03/13: Add dummy source for read-file-name


From: ELPA Syncer
Subject: [nongnu] elpa/helm 49647d3f54 03/13: Add dummy source for read-file-name as well
Date: Sat, 18 May 2024 13:00:18 -0400 (EDT)

branch: elpa/helm
commit 49647d3f5417894bca76cf89e3bfb41d20901dc8
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Add dummy source for read-file-name as well
---
 helm-files.el |  4 ++--
 helm-mode.el  | 14 ++++++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/helm-files.el b/helm-files.el
index 7a82e588a3..1869d369b7 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -3516,7 +3516,7 @@ debugging purpose."
           ;; Return PATTERN unchanged.
           (t pattern))))
 
-(defun helm-find-files-get-candidates (&optional require-match)
+(defun helm-find-files-get-candidates ()
   "Create candidate list for `helm-source-find-files'."
   (let* ((path          (helm-ff-set-pattern helm-pattern))
          (dir-p         (file-accessible-directory-p path))
@@ -5595,7 +5595,7 @@ Use it for non-interactive calls of `helm-find-files'."
 (defvar helm-find-files-dummy-source
   (helm-build-dummy-source "New file or dir"
     :filtered-candidate-transformer
-    (lambda (candidates _source)
+    (lambda (_candidates _source)
       (unless (file-exists-p helm-pattern)
         (list (helm-ff-filter-candidate-one-by-one helm-pattern nil t))))
     :action #'helm-find-file-or-marked))
diff --git a/helm-mode.el b/helm-mode.el
index 5bf41b3d26..b248504d75 100644
--- a/helm-mode.el
+++ b/helm-mode.el
@@ -2009,7 +2009,14 @@ Keys description:
              :must-match must-match
              :nomark nomark
              :action action-fn)
-           ;; Other source.
+           ;; Non existing file or dir source.
+           (unless must-match
+             (helm-build-dummy-source "New file or dir"
+               :filtered-candidate-transformer
+               (lambda (_candidates _source)
+                 (unless (file-exists-p helm-pattern)
+                   (list (helm-ff-filter-candidate-one-by-one helm-pattern nil 
t))))))
+           ;; List files source.
            (helm-build-sync-source name
              :header-name (lambda (name)
                             (concat name (substitute-command-keys
@@ -2033,12 +2040,11 @@ Keys description:
                            (cl-loop with hn = (helm-ff--tramp-hostnames)
                                     ;; helm-find-files-get-candidates is
                                     ;; returning a list of cons cells.
-                                    for (d . r) in 
(helm-find-files-get-candidates
-                                                    must-match)
+                                    for (d . r) in 
(helm-find-files-get-candidates)
                                     when (or (member r hn) ; A tramp host
                                              (funcall test r)) ; Test ok
                                     collect (cons d r)))
-                 (helm-find-files-get-candidates must-match)))
+                 (helm-find-files-get-candidates)))
              :update (lambda ()
                        (remhash helm-ff-default-directory
                                 helm-ff--list-directory-cache))



reply via email to

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