diff options
| author | Omar Antolín <omar.antolin@gmail.com> | 2020-04-13 21:57:58 -0500 |
|---|---|---|
| committer | Omar Antolín <omar.antolin@gmail.com> | 2020-04-13 21:57:58 -0500 |
| commit | 938c7639ad420e5c6164b4c883100467e8396330 (patch) | |
| tree | 58e3a0221fc603aa77962c65478073564731dbde | |
| parent | 5e402282db0704abb0fb6b1c16861ecd306b16e3 (diff) | |
Finish fixing problem with file completion
| -rw-r--r-- | orderless.el | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/orderless.el b/orderless.el index 087c80e..b324fc7 100644 --- a/orderless.el +++ b/orderless.el @@ -50,21 +50,23 @@ (when minibuffer-completing-file-name (setq all (completion-pcm--filename-try-filter all))) (condition-case err - (cl-loop for candidate in all - when (cl-loop for regexp in regexps - always (string-match-p regexp candidate)) - collect candidate) + (nconc + (cl-loop for candidate in all + when (cl-loop for regexp in regexps + always (string-match-p regexp candidate)) + collect candidate) + (length prefix)) (invalid-regexp nil)))) (defun orderless-try-completion (string table pred point &optional _metadata) (let* ((lim (car (completion-boundaries string table pred ""))) (prefix (substring string 0 lim)) (all (orderless-all-completions string table pred point))) - (cl-flet ((point-at-end (str) (cons str (length str)))) + (cl-flet ((measured (string) (cons string (length string)))) (cond ((null all) nil) - ((null (cdr all)) (point-at-end (concat prefix (car all)))) - (t (point-at-end string)))))) + ((atom (cdr all)) (measured (concat prefix (car all)))) + (t (measured string)))))) (push '(orderless orderless-try-completion orderless-all-completions |
