Variable: completions-sort

completions-sort is a customizable variable defined in minibuffer.el.gz.

Value

alphabetical

Documentation

Sort candidates in the *Completions* buffer.

Completion candidates in the *Completions* buffer are sorted depending on the value.

If it's nil, sorting is disabled. If it's the symbol alphabetical, candidates are sorted by minibuffer-sort-alphabetically. If it's the symbol historical, candidates are sorted by minibuffer-sort-by-history, which first sorts alphabetically, and then rearranges the order according to the order of the candidates in the minibuffer history. If it's a function, the function is called to sort the candidates. The sorting function takes a list of completion candidate strings, which it may modify; it should return a sorted list, which may be the same.

If the completion-specific metadata provides a display-sort-function, that function overrides the value of this variable.

This variable was added, or its default value changed, in Emacs 30.1.

View in manual

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(defcustom completions-sort 'alphabetical
  "Sort candidates in the *Completions* buffer.

Completion candidates in the *Completions* buffer are sorted
depending on the value.

If it's nil, sorting is disabled.
If it's the symbol `alphabetical', candidates are sorted by
`minibuffer-sort-alphabetically'.
If it's the symbol `historical', candidates are sorted by
`minibuffer-sort-by-history', which first sorts alphabetically,
and then rearranges the order according to the order of the
candidates in the minibuffer history.
If it's a function, the function is called to sort the candidates.
The sorting function takes a list of completion candidate
strings, which it may modify; it should return a sorted list,
which may be the same.

If the completion-specific metadata provides a
`display-sort-function', that function overrides the value of
this variable."
  :type '(choice (const :tag "No sorting" nil)
                 (const :tag "Alphabetical sorting" alphabetical)
                 (const :tag "Historical sorting" historical)
                 (function :tag "Custom function"))
  :version "30.1")