branch: elpa/helm
commit c4561f3cf0a47303da7c0baab481a102ef6f523e
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>
Fix error in read-file-name when source is empty
---
helm-files.el | 18 +++++++++++-------
helm-mode.el | 1 +
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/helm-files.el b/helm-files.el
index f815b67451..895aea6940 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -2605,13 +2605,17 @@ If prefix numeric arg is given go ARG level up."
(let ((cur-cand (helm-get-selection nil nil src))
(new-pattern (helm-reduce-file-name helm-pattern arg)))
;; Ensure visibility on all candidates for preselection.
- (helm-set-attr 'candidate-number-limit
- (if helm-ff-up-one-level-preselect
- (max (gethash new-pattern
- helm-ff--directory-files-length
- helm-ff-candidate-number-limit)
- helm-ff-candidate-number-limit)
- helm-ff-candidate-number-limit))
+ (unless (helm-empty-source-p)
+ ;; We may have an empty source in read-file-name when a
+ ;; predicate is used e.g. images and the default is a non
+ ;; file image.
+ (helm-set-attr 'candidate-number-limit
+ (if helm-ff-up-one-level-preselect
+ (max (gethash new-pattern
+ helm-ff--directory-files-length
+ helm-ff-candidate-number-limit)
+ helm-ff-candidate-number-limit)
+ helm-ff-candidate-number-limit)))
(cond ((file-directory-p helm-pattern)
(setq helm-ff-last-expanded helm-ff-default-directory))
((file-exists-p helm-pattern)
diff --git a/helm-mode.el b/helm-mode.el
index d0af930bdc..8de1a18de7 100644
--- a/helm-mode.el
+++ b/helm-mode.el
@@ -1435,6 +1435,7 @@ Keys description:
:mode-line mode-line
:help-message 'helm-read-file-name-help-message
:nohighlight t
+ :candidate-number-limit 'helm-ff-candidate-number-limit
:candidates
(lambda ()
(if test