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