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 completions-header-format
(insert (format completions-header-format (length completions)))
(unless completion-show-help
;; Ensure beginning-of-buffer isn't a completion.
(insert (propertize "\n" 'face '(:height 0)))))
(completion--insert-strings completions group-fun)))
(run-hooks 'completion-setup-hook)
nil)