Subject: bug#74865: [PATCH] Use `completion-table-with-metadata'

From: Juri Linkov <[email-masked]>
Date: Mon, 03 Feb 2025 09:50:46 +0200

This change removed affixation-function from another if-branch in 'read-face-name'
for the case when 'multiple' is t that uses completing-read-multiple:

> diff --git a/lisp/faces.el b/lisp/faces.el
> index f8ec0f1a187..05df685c679 100644
> --- a/lisp/faces.el
> +++ b/lisp/faces.el
> @@ -1147,17 +1147,6 @@ read-face-name
>      (let ((prompt (if default
>                        (format-prompt prompt default)
>                      (format "%s: " prompt)))
> -          (completion-extra-properties
> -           `(:affixation-function
> -             ,(lambda (faces)
> -                (mapcar
> -                 (lambda (face)
> -                   (list face
> -                         (concat (propertize read-face-name-sample-text
> -                                             'face face)
> -                                 "\t")
> -                         ""))
> -                 faces))))
>            aliasfaces nonaliasfaces faces)
>        ;; Build up the completion tables.
>        (mapatoms (lambda (s)
> @@ -1180,7 +1169,18 @@ read-face-name
>              (nreverse faces))
>          (let ((face (completing-read
>                       prompt
> -                     (completion-table-in-turn nonaliasfaces aliasfaces)
> +                     (completion-table-with-metadata
> +                      (completion-table-in-turn nonaliasfaces aliasfaces)
> +                      `((affixation-function
> +                        . ,(lambda (faces)
> +                             (mapcar
> +                              (lambda (face)
> +                                (list face
> +                                      (concat (propertize read-face-name-sample-text
> +                                                          'face face)
> +                                              "\t")
> +                                      ""))
> +                              faces)))))
>                       nil t nil 'face-name-history defaults)))
>            (when (facep face) (if (stringp face)
>                                   (intern face)