Function: display-completion-list
display-completion-list is a byte-compiled function defined in
minibuffer.el.gz.
Signature
(display-completion-list COMPLETIONS)
Documentation
Display the list of completions, COMPLETIONS, using standard-output.
Each element may be just a symbol or string
or may be a list of two strings to be printed as if concatenated.
If it is a list of two strings, the first is the actual completion
alternative, the second serves as annotation.
standard-output must be a buffer.
The actual completion alternatives, as inserted, are given mouse-face
properties of highlight.
At the end, this runs the normal hook completion-setup-hook.
It can find the completion buffer in standard-output.
GROUP-FUN is a group-function used for grouping the completion
candidates.
Probably introduced at or before Emacs version 22.1.
Source Code
;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(defun display-completion-list (completions &optional common-substring group-fun)
"Display the list of completions, COMPLETIONS, using `standard-output'.
Each element may be just a symbol or string
or may be a list of two strings to be printed as if concatenated.
If it is a list of two strings, the first is the actual completion
alternative, the second serves as annotation.
`standard-output' must be a buffer.
The actual completion alternatives, as inserted, are given `mouse-face'
properties of `highlight'.
At the end, this runs the normal hook `completion-setup-hook'.
It can find the completion buffer in `standard-output'.
GROUP-FUN is a `group-function' used for grouping the completion
candidates."
(declare (advertised-calling-convention (completions) "24.4"))
(if common-substring
(setq completions (completion-hilit-commonality
completions (length common-substring)
;; We don't know the base-size.
nil)))
(if (not (bufferp standard-output))
;; This *never* (ever) happens, so there's no point trying to be clever.
(with-temp-buffer
(let ((standard-output (current-buffer))
(completion-setup-hook nil))
(with-suppressed-warnings ((callargs display-completion-list))
(display-completion-list completions common-substring group-fun)))
(princ (buffer-string)))
(with-current-buffer standard-output
(goto-char (point-max))
(if (null completions)
(insert "There are no possible completions of what you have typed.")
(insert "Possible completions are:\n")
(completion--insert-strings completions group-fun))))
(run-hooks 'completion-setup-hook)
nil)