diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2015-02-25 09:02:12 +0100 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2015-02-25 09:02:12 +0100 |
commit | ff090278ade18945fdde6d875d4f92c833f69726 (patch) | |
tree | b2174016fc748dc43abf31544935fcc25193d394 /helm-mode.el | |
parent | 8b14fb400bad12d57997ed8ac8509def8ead9ec0 (diff) | |
parent | 6c5e8f8afd0e178aacc3ab794062070de0cdb0ea (diff) |
Merge branch 'master' into highlight_matches
Diffstat (limited to 'helm-mode.el')
-rw-r--r-- | helm-mode.el | 104 |
1 files changed, 53 insertions, 51 deletions
diff --git a/helm-mode.el b/helm-mode.el index b9341f4b..d2c38f2c 100644 --- a/helm-mode.el +++ b/helm-mode.el @@ -949,58 +949,60 @@ Can be used as value for `completion-in-region-function'." (afun (plist-get completion-extra-properties :annotation-function)) (data (all-completions input collection predicate)) (init-space-suffix (unless helm-completion-in-region-fuzzy-match " ")) - (file-comp-p (helm-mode--in-file-completion-p input (car data))) + (file-comp-p (helm-mode--in-file-completion-p input (car-safe data))) ;; Completion-at-point and friends have no prompt. - (result (helm-comp-read - (or (and (boundp 'prompt) prompt) "Pattern: ") - (if file-comp-p - (cl-loop for f in data unless - (string-match "\\`\\.\\{1,2\\}/\\'" f) - collect f) - (if afun - (mapcar (lambda (s) - (let ((ann (funcall afun s))) - (if ann - (cons - (concat - s - (propertize - " " 'display - (propertize - ann - 'face 'completions-annotations))) - s) - s))) - data) - data)) - :name str-command - :fuzzy helm-completion-in-region-fuzzy-match - :nomark t - :initial-input - (cond ((and file-comp-p - (not (string-match "/\\'" input))) - (concat (helm-basename input) - (unless (string= input "") - init-space-suffix))) - ((string-match "/\\'" input) nil) - ((or (null require-match) - (stringp require-match)) - input) - (t (concat input init-space-suffix))) - :buffer buf-name - :fc-transformer (append (list 'helm-cr-default-transformer) - (list (lambda (candidates _source) - (sort candidates 'helm-generic-sort-fn)))) - :exec-when-only-one t - :quit-when-no-cand - #'(lambda () - ;; Delay message to overwrite "Quit". - (run-with-timer - 0.01 nil - #'(lambda () - (message "[No matches]"))) - t) ; exit minibuffer immediately. - :must-match require-match))) + (result (if (stringp data) + data + (helm-comp-read + (or (and (boundp 'prompt) prompt) "Pattern: ") + (if file-comp-p + (cl-loop for f in data unless + (string-match "\\`\\.\\{1,2\\}/\\'" f) + collect f) + (if afun + (mapcar (lambda (s) + (let ((ann (funcall afun s))) + (if ann + (cons + (concat + s + (propertize + " " 'display + (propertize + ann + 'face 'completions-annotations))) + s) + s))) + data) + data)) + :name str-command + :fuzzy helm-completion-in-region-fuzzy-match + :nomark t + :initial-input + (cond ((and file-comp-p + (not (string-match "/\\'" input))) + (concat (helm-basename input) + (unless (string= input "") + init-space-suffix))) + ((string-match "/\\'" input) nil) + ((or (null require-match) + (stringp require-match)) + input) + (t (concat input init-space-suffix))) + :buffer buf-name + :fc-transformer (append (list 'helm-cr-default-transformer) + (list (lambda (candidates _source) + (sort candidates 'helm-generic-sort-fn)))) + :exec-when-only-one t + :quit-when-no-cand + #'(lambda () + ;; Delay message to overwrite "Quit". + (run-with-timer + 0.01 nil + #'(lambda () + (message "[No matches]"))) + t) ; exit minibuffer immediately. + :must-match require-match)))) (when result (delete-region (if (and file-comp-p (save-excursion |