[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-27 195bde9 7/7: Don't always resort in recently introduced icomple
From: |
João Távora |
Subject: |
emacs-27 195bde9 7/7: Don't always resort in recently introduced icomplete--sorted-completions |
Date: |
Tue, 31 Dec 2019 08:32:05 -0500 (EST) |
branch: emacs-27
commit 195bde9ea82e7bc62d7242bcf089ef3d181020f1
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Don't always resort in recently introduced icomplete--sorted-completions
Doing so breaks icomplete-forward-completions and
icomplete-backward-completions.
* lisp/icomplete.el (icomplete--sorted-completions): Don't always
resort.
(cherry picked from commit 639fb50ed4c622f99dfbde32fbdbca42ce36d385)
---
lisp/icomplete.el | 61 ++++++++++++++++++++++++++++---------------------------
1 file changed, 31 insertions(+), 30 deletions(-)
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 3b3cabb..6bc75b3 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -442,36 +442,37 @@ Usually run by inclusion in `minibuffer-setup-hook'."
(add-hook 'post-command-hook 'icomplete-post-command-hook nil t)))
(defun icomplete--sorted-completions ()
- (cl-loop
- with beg = (icomplete--field-beg)
- with end = (icomplete--field-end)
- with all = (completion-all-sorted-completions beg end)
- for fn in (cond ((and minibuffer-default
- (= (icomplete--field-end) (icomplete--field-beg)))
- ;; When we have a non-nil default and no input
- ;; whatsoever: we want to make sure that default
- ;; is bubbled to the top so that
- ;; `icomplete-force-complete-and-exit' will
- ;; select it (do that even if the match doesn't
- ;; match the completion perfectly.
- `(,(lambda (comp)
- (equal minibuffer-default comp))
- ,(lambda (comp)
- (string-prefix-p minibuffer-default comp))))
- ((and fido-mode
- (not minibuffer-default)
- (eq (icomplete--category) 'file))
- `(,(lambda (comp)
- (string= "./" comp)))))
- thereis (cl-loop
- for l on all
- while (consp (cdr l))
- for comp = (cadr l)
- when (funcall fn comp)
- do (setf (cdr l) (cddr l))
- and return
- (completion--cache-all-sorted-completions beg end (cons comp all)))
- finally return all))
+ (or completion-all-sorted-completions
+ (cl-loop
+ with beg = (icomplete--field-beg)
+ with end = (icomplete--field-end)
+ with all = (completion-all-sorted-completions beg end)
+ for fn in (cond ((and minibuffer-default
+ (= (icomplete--field-end) (icomplete--field-beg)))
+ ;; When we have a non-nil default and no input
+ ;; whatsoever: we want to make sure that default
+ ;; is bubbled to the top so that
+ ;; `icomplete-force-complete-and-exit' will
+ ;; select it (do that even if the match doesn't
+ ;; match the completion perfectly.
+ `(,(lambda (comp)
+ (equal minibuffer-default comp))
+ ,(lambda (comp)
+ (string-prefix-p minibuffer-default comp))))
+ ((and fido-mode
+ (not minibuffer-default)
+ (eq (icomplete--category) 'file))
+ `(,(lambda (comp)
+ (string= "./" comp)))))
+ thereis (cl-loop
+ for l on all
+ while (consp (cdr l))
+ for comp = (cadr l)
+ when (funcall fn comp)
+ do (setf (cdr l) (cddr l))
+ and return
+ (completion--cache-all-sorted-completions beg end (cons comp
all)))
+ finally return all)))
- emacs-27 updated (9b6872b -> 195bde9), João Távora, 2019/12/31
- emacs-27 5352947 1/7: Another adjustment to flex completion style's sorting function, João Távora, 2019/12/31
- emacs-27 e3276f3 3/7: Make fido-mode behave more like ido-mode when finding directories, João Távora, 2019/12/31
- emacs-27 b1c3ed9 4/7: Move flex style's minibuffer-default-aware sorting to lisp/icomplete.el, João Távora, 2019/12/31
- emacs-27 9b1053b 5/7: Correctly cache sorted completions in icomplete--sorted-completions, João Távora, 2019/12/31
- emacs-27 fe0ed17 2/7: Slightly simplify lisp/icomplete.el with new icomplete--category helper, João Távora, 2019/12/31
- emacs-27 f2a349b 6/7: Don't force completion recalculation in icomplete-fido-ret, João Távora, 2019/12/31
- emacs-27 195bde9 7/7: Don't always resort in recently introduced icomplete--sorted-completions,
João Távora <=