Function: completion-pcm--hilit-commonality
completion-pcm--hilit-commonality is a byte-compiled function defined
in minibuffer.el.gz.
Signature
(completion-pcm--hilit-commonality PATTERN COMPLETIONS)
Documentation
Show where and how well PATTERN matches COMPLETIONS.
PATTERN, a list of symbols and strings as seen
completion-pcm--merge-completions, is assumed to match every
string in COMPLETIONS.
If completion-lazy-hilit(var)/completion-lazy-hilit(fun) is nil, return a deep copy of
COMPLETIONS where each string is propertized with
completion-score, a number between 0 and 1, and with faces
completions-common-part, completions-first-difference in the
relevant segments.
Else, if completion-lazy-hilit(var)/completion-lazy-hilit(fun) is t, return COMPLETIONS
unchanged, but setup a suitable completion-lazy-hilit-fn (which
see) for later lazy highlighting.
Source Code
;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(defun completion-pcm--hilit-commonality (pattern completions)
"Show where and how well PATTERN matches COMPLETIONS.
PATTERN, a list of symbols and strings as seen
`completion-pcm--merge-completions', is assumed to match every
string in COMPLETIONS.
If `completion-lazy-hilit' is nil, return a deep copy of
COMPLETIONS where each string is propertized with
`completion-score', a number between 0 and 1, and with faces
`completions-common-part', `completions-first-difference' in the
relevant segments.
Else, if `completion-lazy-hilit' is t, return COMPLETIONS
unchanged, but setup a suitable `completion-lazy-hilit-fn' (which
see) for later lazy highlighting."
(setq completion-pcm--regexp nil
completion-lazy-hilit-fn nil)
(cond
((and completions (cl-loop for e in pattern thereis (stringp e)))
(let* ((segments (completion-pcm--pattern->segments pattern))
(re (completion-pcm--segments->regex segments 'group))
(point-idx (completion-pcm--segments-point-idx segments)))
(setq completion-pcm--regexp re)
(cond (completion-lazy-hilit
(setq completion-lazy-hilit-fn
(lambda (str) (completion--hilit-from-re str re point-idx)))
completions)
(t
(mapcar
(lambda (str)
(completion--hilit-from-re (copy-sequence str) re point-idx))
completions)))))
(t completions)))