diff options
| -rw-r--r-- | lisp/icomplete.el | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 3b3cabb890e..6bc75b39edb 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el | |||
| @@ -442,36 +442,37 @@ Usually run by inclusion in `minibuffer-setup-hook'." | |||
| 442 | (add-hook 'post-command-hook 'icomplete-post-command-hook nil t))) | 442 | (add-hook 'post-command-hook 'icomplete-post-command-hook nil t))) |
| 443 | 443 | ||
| 444 | (defun icomplete--sorted-completions () | 444 | (defun icomplete--sorted-completions () |
| 445 | (cl-loop | 445 | (or completion-all-sorted-completions |
| 446 | with beg = (icomplete--field-beg) | 446 | (cl-loop |
| 447 | with end = (icomplete--field-end) | 447 | with beg = (icomplete--field-beg) |
| 448 | with all = (completion-all-sorted-completions beg end) | 448 | with end = (icomplete--field-end) |
| 449 | for fn in (cond ((and minibuffer-default | 449 | with all = (completion-all-sorted-completions beg end) |
| 450 | (= (icomplete--field-end) (icomplete--field-beg))) | 450 | for fn in (cond ((and minibuffer-default |
| 451 | ;; When we have a non-nil default and no input | 451 | (= (icomplete--field-end) (icomplete--field-beg))) |
| 452 | ;; whatsoever: we want to make sure that default | 452 | ;; When we have a non-nil default and no input |
| 453 | ;; is bubbled to the top so that | 453 | ;; whatsoever: we want to make sure that default |
| 454 | ;; `icomplete-force-complete-and-exit' will | 454 | ;; is bubbled to the top so that |
| 455 | ;; select it (do that even if the match doesn't | 455 | ;; `icomplete-force-complete-and-exit' will |
| 456 | ;; match the completion perfectly. | 456 | ;; select it (do that even if the match doesn't |
| 457 | `(,(lambda (comp) | 457 | ;; match the completion perfectly. |
| 458 | (equal minibuffer-default comp)) | 458 | `(,(lambda (comp) |
| 459 | ,(lambda (comp) | 459 | (equal minibuffer-default comp)) |
| 460 | (string-prefix-p minibuffer-default comp)))) | 460 | ,(lambda (comp) |
| 461 | ((and fido-mode | 461 | (string-prefix-p minibuffer-default comp)))) |
| 462 | (not minibuffer-default) | 462 | ((and fido-mode |
| 463 | (eq (icomplete--category) 'file)) | 463 | (not minibuffer-default) |
| 464 | `(,(lambda (comp) | 464 | (eq (icomplete--category) 'file)) |
| 465 | (string= "./" comp))))) | 465 | `(,(lambda (comp) |
| 466 | thereis (cl-loop | 466 | (string= "./" comp))))) |
| 467 | for l on all | 467 | thereis (cl-loop |
| 468 | while (consp (cdr l)) | 468 | for l on all |
| 469 | for comp = (cadr l) | 469 | while (consp (cdr l)) |
| 470 | when (funcall fn comp) | 470 | for comp = (cadr l) |
| 471 | do (setf (cdr l) (cddr l)) | 471 | when (funcall fn comp) |
| 472 | and return | 472 | do (setf (cdr l) (cddr l)) |
| 473 | (completion--cache-all-sorted-completions beg end (cons comp all))) | 473 | and return |
| 474 | finally return all)) | 474 | (completion--cache-all-sorted-completions beg end (cons comp all))) |
| 475 | finally return all))) | ||
| 475 | 476 | ||
| 476 | 477 | ||
| 477 | 478 | ||