Subject: 28.0.50; [PATCH] Face used for affixation function annotations

From: Clemens <[email-masked]>
Date: Mon, 11 Jan 2021 13:38:13 +0100

As per the comment above the affected code, the client can specify the 
face when prefix and suffix are provided. The prefix is already checked 
earlier and what remained was checking the suffix not the prefix.

There is another thing I would like to bring up in this context: When 
the annotations returned by annotation/affixation functions already 
specify a face I think it would be nicer if the completion-annotations 
face wouldn't be applied generally. In Selectrum we use something like:

(if (text-property-not-all 0 (length str) 'face nil str)
     str
   (propertize str 'face 'completions-annotations))

This gives the client full control over the visual appearance if that is 
preferred. Maybe this approach could also make sense to be included in 
Emacs? Currently for the annotation function the completions-annotations 
face is always applied and for the affixation function it also still 
gets applied when the affixation function returns a two candidate list 
(like read-extended-command--affixation on current master). The case of 
also allowing a two candidate list to be returned by affixation 
functions is also currently undocumented.

     Clemens
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 556f5d3a56..a6afb04efb 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1790,7 +1790,7 @@ completion--insert-strings
                     ;; by the caller via affixation-function,
                     ;; then allow the caller to decide
                     ;; what faces to put on prefix and suffix.
-                    (unless prefix
+                    (unless suffix
                       (font-lock-prepend-text-property
                        beg end 'face 'completions-annotations))))
                 (put-text-property (point) (progn (insert (car str)) (point))