[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm 3c390b99f5 02/13: Use a dummy source for not existing
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm 3c390b99f5 02/13: Use a dummy source for not existing files in HFF |
Date: |
Sat, 18 May 2024 13:00:17 -0400 (EDT) |
branch: elpa/helm
commit 3c390b99f5866979cdbddd0ab30c7044bb2dba5c
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Use a dummy source for not existing files in HFF
---
helm-files.el | 40 ++++++++++++----------------------------
1 file changed, 12 insertions(+), 28 deletions(-)
diff --git a/helm-files.el b/helm-files.el
index 5fd28ff4f5..7a82e588a3 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -3588,7 +3588,8 @@ debugging purpose."
(when (and (string-match ":\\'" path)
(file-remote-p basedir nil t))
(setq helm-pattern basedir))
- (cond ((string-match helm-ff-tramp-method-regexp path) ; Tramp methods
+ (cond (invalid-basedir nil)
+ ((string-match helm-ff-tramp-method-regexp path) ; Tramp methods
(mapcar (lambda (method)
(helm-ff-filter-candidate-one-by-one
(concat "/" ":" method)))
@@ -3599,8 +3600,6 @@ debugging purpose."
(eq last-repeatable-command
'helm-execute-persistent-action))
;; `ffap-url-regexp' don't match until url is complete.
(string-match helm-ff-url-regexp path)
- invalid-basedir
- (and (not (file-exists-p path)) (string-match "/$" path))
(and helm--url-regexp (string-match helm--url-regexp path)))
;; Do NOT filter boring files here (Bug#2330).
(list (helm-ff-filter-candidate-one-by-one path nil t)))
@@ -3615,30 +3614,7 @@ debugging purpose."
;; is enabled.
((and dir-p helm-ff-auto-update-flag)
(helm-ff-directory-files path))
- (t (append (unless (or (eq require-match t)
- ;; Check here if path is an existing
- ;; file before adding it to
- ;; candidates, it was previously done
- ;; in the sort function but this
- ;; create a bug with remote files
- ;; when path is at the same time a
- ;; pattern matching a candidate and a
- ;; real candidate e.g. ack and
- ;; ack-grep in /usr/bin. This is due
- ;; presumably to a latency more
- ;; important with remote files which
- ;; lead to a confusion with the
- ;; pattern matching one candidate and
- ;; the real candidate which is same
- ;; as pattern.
- (file-exists-p path)
- ;; When `helm-ff-auto-update-flag' has been
- ;; disabled, whe don't want PATH to be added
on top
- ;; if it is a directory.
- dir-p)
- ;; Do NOT filter boring files here (Bug#2330).
- (list (helm-ff-filter-candidate-one-by-one path nil t)))
- (helm-ff-directory-files basedir))))))
+ (t (helm-ff-directory-files basedir)))))
(defun helm-list-directory (directory &optional sel)
"List directory DIRECTORY.
@@ -5604,7 +5580,7 @@ Use it for non-interactive calls of `helm-find-files'."
(helm-ff-setup-update-hook)
(add-hook 'helm-resume-after-hook 'helm-ff--update-resume-after-hook)
(unwind-protect
- (helm :sources 'helm-source-find-files
+ (helm :sources '(helm-source-find-files helm-find-files-dummy-source)
:input fname
:case-fold-search helm-file-name-case-fold-search
:preselect preselect
@@ -5616,6 +5592,14 @@ Use it for non-interactive calls of `helm-find-files'."
(helm-ff--update-resume-after-hook nil t)
(setq helm-ff-default-directory nil))))
+(defvar helm-find-files-dummy-source
+ (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))))
+ :action #'helm-find-file-or-marked))
+
(defun helm-ff--update-resume-after-hook (sources &optional nohook)
"Meant to be used in `helm-resume-after-hook'.
When NOHOOK is non-nil run inconditionally, otherwise only when
- [nongnu] elpa/helm a4ac705b1c 07/13: Ensure lynx style map is used in new HFF dummy source, (continued)
- [nongnu] elpa/helm a4ac705b1c 07/13: Ensure lynx style map is used in new HFF dummy source, ELPA Syncer, 2024/05/18
- [nongnu] elpa/helm 4cb0f2e5c3 06/13: Allow using C-l in new HFF dummy source, ELPA Syncer, 2024/05/18
- [nongnu] elpa/helm c71be6c5b1 12/13: Bind missing keys to helm-find-files-dummy-map, ELPA Syncer, 2024/05/18
- [nongnu] elpa/helm ba2eb55235 13/13: Fix dummy sources name, ELPA Syncer, 2024/05/18
- [nongnu] elpa/helm 49647d3f54 03/13: Add dummy source for read-file-name as well, ELPA Syncer, 2024/05/18
- [nongnu] elpa/helm e48f65bc7e 09/13: Move helm-read-file-dummy-map to helm-files to avoid errors, ELPA Syncer, 2024/05/18
- [nongnu] elpa/helm a779dd2607 01/13: Use `truncate-string-ellipsis` as default for helm-buffers-end-truncated-string, ELPA Syncer, 2024/05/18
- [nongnu] elpa/helm 0d928a6c31 05/13: Add missing actions to helm-find-files-dummy-source, ELPA Syncer, 2024/05/18
- [nongnu] elpa/helm f54356fc27 04/13: Get rid of helm-ff-move-to-first-real-candidate, ELPA Syncer, 2024/05/18
- [nongnu] elpa/helm 996e2cab6d 08/13: Move dummy map on top, ELPA Syncer, 2024/05/18
- [nongnu] elpa/helm 3c390b99f5 02/13: Use a dummy source for not existing files in HFF,
ELPA Syncer <=