]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify 'completion-all-sorted-completions'
authorEshel Yaron <me@eshelyaron.com>
Mon, 18 Mar 2024 15:37:46 +0000 (16:37 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 18 Mar 2024 15:37:46 +0000 (16:37 +0100)
lisp/minibuffer.el

index 5fc4a9254d5cf3bbb8baa502ef1ad0fed1585698..b67ce30e974c498d1afab6e79bb4b470a05c0da7 100644 (file)
@@ -2000,7 +2000,6 @@ include as `sort-function' in completion metadata."
                     ('alphabetical #'minibuffer-sort-alphabetically)
                     ('historical #'minibuffer-sort-by-history)
                     (_ completions-sort))))
-             (group-fun (completion-metadata-get all-md 'group-function))
              (full-base (substring string 0 base-size))
              (minibuffer-completion-base
               (funcall (or (alist-get 'adjust-base-function all-md) #'identity)
@@ -2014,24 +2013,7 @@ include as `sort-function' in completion metadata."
           (setq all (delete-dups all))
           (setq last (last all))
 
-          (cond
-           (sort-fun (setq all (funcall sort-fun all)))
-           ((and completions-group group-fun)
-            ;; TODO: experiment with re-grouping here.  Might be slow
-            ;; if the group-fun (given by the table and out of our
-            ;; control) is slow and/or allocates too much.
-            )
-           (t
-            ;; If the table doesn't stipulate a sorting function or a
-            ;; group function, sort first by length and
-            ;; alphabetically.
-            (setq all (minibuffer--sort-by-length-alpha all))
-            ;; Then sort by history position, and put the default, if it
-            ;; exists, on top.
-            (when (minibufferp)
-              (setq all (minibuffer--sort-by-position
-                         (minibuffer--sort-preprocess-history full-base)
-                         all)))))
+          (when sort-fun (setq all (funcall sort-fun all)))
 
           ;; Cache input for `minibuffer-restore-completion-input',
           ;; unless STRING is an exact and sole completion.