Variable: completion-preview-sort-function
completion-preview-sort-function is a customizable variable defined in
completion-preview.el.gz.
Value
minibuffer--sort-by-length-alpha
Documentation
Sort function to use for choosing a completion candidate to preview.
Completion Preview mode calls the function that this option specifies to sort completion candidates. The function takes one argument, the list of candidates, and returns the list sorted.
The default sort function sorts first by length, then alphabetically.
To disable sorting, set this option to identity.
If the completion table that produces the candidates already specifies a sort function, it takes precedence over this option.
This variable was added, or its default value changed, in Emacs 31.1.
Probably introduced at or before Emacs version 31.1.
Source Code
;; Defined in /usr/src/emacs/lisp/completion-preview.el.gz
(defcustom completion-preview-sort-function #'minibuffer--sort-by-length-alpha
"Sort function to use for choosing a completion candidate to preview.
Completion Preview mode calls the function that this option specifies to
sort completion candidates. The function takes one argument, the list
of candidates, and returns the list sorted.
The default sort function sorts first by length, then alphabetically.
To disable sorting, set this option to `identity'.
If the completion table that produces the candidates already specifies a
sort function, it takes precedence over this option."
:type '(choice
(function-item :tag "Sort alphabetically"
minibuffer-sort-alphabetically)
(function-item :tag "First by length, then alphabetically"
minibuffer--sort-by-length-alpha)
(function-item :tag "Disable sorting" identity)
(function :tag "Custom sort function"))
:version "31.1")