diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2015-01-22 07:26:17 +0100 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2015-01-22 07:26:17 +0100 |
commit | 7c4f6b7bea09e7846840988f18e8cee6356acbc0 (patch) | |
tree | 36bdba127f626aa3ec4668cd74c79a4a2a578b70 /helm-mode.el | |
parent | 6a4d35088036aaf9602e9e234a58f2ec4198d8e0 (diff) |
* helm-mode.el (helm-read-file-name): Use helm-source to builds sources.
Diffstat (limited to 'helm-mode.el')
-rw-r--r-- | helm-mode.el | 88 |
1 files changed, 45 insertions, 43 deletions
diff --git a/helm-mode.el b/helm-mode.el index 98e95d76..ed5fd9e8 100644 --- a/helm-mode.el +++ b/helm-mode.el @@ -764,50 +764,52 @@ Keys description: (replace-regexp-in-string "helm-maybe-exit-minibuffer" "helm-confirm-and-exit-minibuffer" helm-read-file-name-mode-line-string)) - (src-list `(((name . ,(format "%s History" name)) - (header-name . (lambda (hname) - (concat hname - helm-find-files-doc-header))) - (mode-line . ,mode-line) - (candidates . ,hist) - (persistent-action . ,persistent-action) - (persistent-help . ,persistent-help) - (action . ,action-fn)) - ((name . ,name) - (header-name . (lambda (hname) - (concat hname - helm-find-files-doc-header))) - (init . (lambda () - (setq helm-ff-auto-update-flag - helm-ff-auto-update-initial-value) - (setq helm-ff--auto-update-state - helm-ff-auto-update-flag) - (helm-set-local-variable 'helm-in-file-completion-p t))) - (mode-line . ,mode-line) - (candidates - . (lambda () - (append (and (not (file-exists-p helm-pattern)) - (list helm-pattern)) - (if ',test - (cl-loop with hn = (helm-ff-tramp-hostnames) - for i in (helm-find-files-get-candidates - ',must-match) - when (or (member i hn) ; A tramp host - (funcall ',test i)) ; Test ok - collect i) - (helm-find-files-get-candidates ',must-match))))) - (filtered-candidate-transformer . helm-ff-sort-candidates) - (filter-one-by-one . helm-ff-filter-candidate-one-by-one) - (persistent-action . ,persistent-action) - (candidate-number-limit . 9999) - (persistent-help . ,persistent-help) - (volatile) - (action . ,action-fn)))) + (src-list + (list + ;; History source. + (helm-build-sync-source (format "%s History" name) + :header-name (lambda (hname) + (concat hname helm-find-files-doc-header)) + :mode-line mode-line + :candidates hist + :persistent-action persistent-action + :persistent-help persistent-help + :nomark nomark + :action action-fn) + ;; Other source. + (helm-build-sync-source name + :header-name (lambda (hname) + (concat hname helm-find-files-doc-header)) + :init (lambda () + (setq helm-ff-auto-update-flag + helm-ff-auto-update-initial-value) + (setq helm-ff--auto-update-state + helm-ff-auto-update-flag) + (helm-set-local-variable 'helm-in-file-completion-p t)) + :mode-line mode-line + :candidates + (lambda () + (append (and (not (file-exists-p helm-pattern)) + (list helm-pattern)) + (if test + (cl-loop with hn = (helm-ff-tramp-hostnames) + for i in (helm-find-files-get-candidates + must-match) + when (or (member i hn) ; A tramp host + (funcall test i)) ; Test ok + collect i) + (helm-find-files-get-candidates must-match)))) + :filtered-candidate-transformer 'helm-ff-sort-candidates + :filter-one-by-one 'helm-ff-filter-candidate-one-by-one + :persistent-action persistent-action + :candidate-number-limit 9999 + :persistent-help persistent-help + :volatile t + :nomark nomark + :action action-fn))) + ;; Helm result. (result (helm - :sources (if nomark - (cl-loop for src in src-list - collect (cons '(nomark) src)) - src-list) + :sources src-list :input initial-input :prompt prompt :keymap cmap |