GNU bug report logs - #45780
28.0.50; [PATCH] Face used for affixation function annotations

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Clemens <clemera@HIDDEN>; Keywords: patch; dated Mon, 11 Jan 2021 12:39:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 45780 <at> debbugs.gnu.org:


Received: (at 45780) by debbugs.gnu.org; 14 Jan 2021 19:13:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 14 14:13:22 2021
Received: from localhost ([127.0.0.1]:39272 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l083e-0001jX-1i
	for submit <at> debbugs.gnu.org; Thu, 14 Jan 2021 14:13:22 -0500
Received: from relay6-d.mail.gandi.net ([217.70.183.198]:49485)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1l083b-0001j9-A3
 for 45780 <at> debbugs.gnu.org; Thu, 14 Jan 2021 14:13:20 -0500
X-Originating-IP: 91.129.98.64
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id C51BBC000E;
 Thu, 14 Jan 2021 19:13:11 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Clemens <clemera@HIDDEN>
Subject: Re: bug#45780: 28.0.50; [PATCH] Face used for affixation function
 annotations
Organization: LINKOV.NET
References: <9b1409af-58b9-3a62-4162-343fd25293ca@HIDDEN>
 <87ft378gjk.fsf@HIDDEN>
 <c8b4f5c8-1828-77e4-15f6-160c2bad1e25@HIDDEN>
 <8735z6xx11.fsf@HIDDEN>
 <7763f3e7-475c-9adb-ce62-7801faf47a90@HIDDEN>
 <875z3z50if.fsf@HIDDEN>
 <4779a90d-a475-0490-7de2-de072efe64f5@HIDDEN>
Date: Thu, 14 Jan 2021 20:59:29 +0200
In-Reply-To: <4779a90d-a475-0490-7de2-de072efe64f5@HIDDEN> (Clemens's
 message of "Thu, 14 Jan 2021 18:21:00 +0100")
Message-ID: <87h7nj2vla.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45780
Cc: 45780 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain

>> Do you want to use the completion-annotations face conditionally only
>> for annotations, i.e. when only the suffix is provided by the client?
>> Because when a prefix is provided as well, then it's not an annotation
>> anymore, so the completion-annotations face is not applicable to prefixes.
>
> I see, personally I think of all strings besides the completions themselves
> as annotations ;) Makes sense to do it only for the suffix then.
>
>> Doing this is not something new, we already have the same logic
>> in minibuffer-message:
>>      (unless (or (null minibuffer-message-properties)
>>                  ;; Don't overwrite the face properties the caller has set
>>                  (text-properties-at 0 message))
>>        (setq message (apply #'propertize message minibuffer-message-properties)))
>> Is this logic suitable for completion-annotations?
>
> I guess this could also be used, the version I posted earlier only checks
> for the face property and then also check the whole string:
>
> (if (text-property-not-all 0 (length str) 'face nil str)
>         str
>       (propertize str 'face face))
>
> When only the face matters my proposed version might be better?

I agree its purpose is quite different from the example above.

Then maybe something like this should do what you want:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=completion--insert-strings-text-property-not-all.patch

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 315f2d369a..31d7be3441 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1785,14 +1800,7 @@ completion--insert-strings
                 (when prefix
                   (let ((beg (point))
                         (end (progn (insert prefix) (point))))
-                    (put-text-property beg end 'mouse-face nil)
-                    ;; When both prefix and suffix are added
-                    ;; by the caller via affixation-function,
-                    ;; then allow the caller to decide
-                    ;; what faces to put on prefix and suffix.
-                    (unless prefix
-                      (font-lock-prepend-text-property
-                       beg end 'face 'completions-annotations))))
+                    (put-text-property beg end 'mouse-face nil)))
                 (put-text-property (point) (progn (insert (car str)) (point))
                                    'mouse-face 'highlight)
                 (let ((beg (point))
@@ -1800,7 +1808,12 @@ completion--insert-strings
                   (put-text-property beg end 'mouse-face nil)
                   ;; Put the predefined face only when suffix
                   ;; is added via annotation-function.
-                  (unless prefix
+                  ;; Otherwise, when only suffix is added
+                  ;; by the caller via annotation-function,
+                  ;; then allow the caller to decide
+                  ;; what faces to put on suffix.
+                  (unless (or prefix (text-property-not-all
+                                      0 (length suffix) 'face nil suffix))
                     (font-lock-prepend-text-property
                      beg end 'face 'completions-annotations)))))
 	    (cond

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45780; Package emacs. Full text available.

Message received at 45780 <at> debbugs.gnu.org:


Received: (at 45780) by debbugs.gnu.org; 14 Jan 2021 17:21:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 14 12:21:13 2021
Received: from localhost ([127.0.0.1]:39090 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l06J7-0007HO-Fm
	for submit <at> debbugs.gnu.org; Thu, 14 Jan 2021 12:21:13 -0500
Received: from mout01.posteo.de ([185.67.36.65]:54421)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <clemera@HIDDEN>) id 1l06J2-0007H7-6h
 for 45780 <at> debbugs.gnu.org; Thu, 14 Jan 2021 12:21:12 -0500
Received: from submission (posteo.de [89.146.220.130]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 989A9160062
 for <45780 <at> debbugs.gnu.org>; Thu, 14 Jan 2021 18:21:01 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1610644861; bh=awBA0syZAEtybf7jQBs5iEcGj1N61GJ8ecV1PFeIhgo=;
 h=Subject:To:Cc:From:Date:From;
 b=G8CCAgrARDEhihgeviLPAs8zoLY17DUqBrra70YjByv6oOZOltymdayqhgrBZOrkd
 4+WqTtMyKgJTOgHQ9B8RJzoLGbsXz/Z+TFTALLpWsyFganI59TxDJLEchfWLJzBQmE
 qYM4DDQZyn8SzU9S36N1QU2d07kfbsN53mvwOJYadP0Cb+UlviYsOsMYoDkHPp4Afe
 IipjcW7PKsZDVxcdyabh+q7ngeBKg+8vkbmNbBflYAPjiLVsJkLATtSPDYLq/T2D0z
 lsp7AXG9zdsZbeEAJbWYZIQ75M2uCOnBaUJhyKY4oAQo5Ale8Hw+QEYxd1k5gHbgbU
 /Iajdi+GHko3w==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4DGrgc6tBQz6tmL;
 Thu, 14 Jan 2021 18:21:00 +0100 (CET)
Subject: Re: bug#45780: 28.0.50; [PATCH] Face used for affixation function
 annotations
To: Juri Linkov <juri@HIDDEN>
References: <9b1409af-58b9-3a62-4162-343fd25293ca@HIDDEN>
 <87ft378gjk.fsf@HIDDEN>
 <c8b4f5c8-1828-77e4-15f6-160c2bad1e25@HIDDEN>
 <8735z6xx11.fsf@HIDDEN>
 <7763f3e7-475c-9adb-ce62-7801faf47a90@HIDDEN>
 <875z3z50if.fsf@HIDDEN>
From: Clemens <clemera@HIDDEN>
Message-ID: <4779a90d-a475-0490-7de2-de072efe64f5@HIDDEN>
Date: Thu, 14 Jan 2021 18:21:00 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
In-Reply-To: <875z3z50if.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.5 (--)
X-Debbugs-Envelope-To: 45780
Cc: 45780 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.5 (---)


> Do you want to use the completion-annotations face conditionally only
> for annotations, i.e. when only the suffix is provided by the client?
> Because when a prefix is provided as well, then it's not an annotation
> anymore, so the completion-annotations face is not applicable to prefixes.


I see, personally I think of all strings besides the completions 
themselves as annotations ;) Makes sense to do it only for the suffix then.

> Doing this is not something new, we already have the same logic
> in minibuffer-message:
> 
>      (unless (or (null minibuffer-message-properties)
>                  ;; Don't overwrite the face properties the caller has set
>                  (text-properties-at 0 message))
>        (setq message (apply #'propertize message minibuffer-message-properties)))
> 
> Is this logic suitable for completion-annotations?

I guess this could also be used, the version I posted earlier only 
checks for the face property and then also check the whole string:

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


When only the face matters my proposed version might be better?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45780; Package emacs. Full text available.

Message received at 45780 <at> debbugs.gnu.org:


Received: (at 45780) by debbugs.gnu.org; 14 Jan 2021 09:39:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 14 04:39:28 2021
Received: from localhost ([127.0.0.1]:37223 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kzz6G-00085O-JY
	for submit <at> debbugs.gnu.org; Thu, 14 Jan 2021 04:39:28 -0500
Received: from relay8-d.mail.gandi.net ([217.70.183.201]:42975)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1kzz6E-00084z-NQ
 for 45780 <at> debbugs.gnu.org; Thu, 14 Jan 2021 04:39:27 -0500
X-Originating-IP: 91.129.98.64
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 209C31BF205;
 Thu, 14 Jan 2021 09:39:18 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Clemens <clemera@HIDDEN>
Subject: Re: bug#45780: 28.0.50; [PATCH] Face used for affixation function
 annotations
Organization: LINKOV.NET
References: <9b1409af-58b9-3a62-4162-343fd25293ca@HIDDEN>
 <87ft378gjk.fsf@HIDDEN>
 <c8b4f5c8-1828-77e4-15f6-160c2bad1e25@HIDDEN>
 <8735z6xx11.fsf@HIDDEN>
 <7763f3e7-475c-9adb-ce62-7801faf47a90@HIDDEN>
Date: Thu, 14 Jan 2021 11:00:16 +0200
In-Reply-To: <7763f3e7-475c-9adb-ce62-7801faf47a90@HIDDEN> (Clemens's
 message of "Wed, 13 Jan 2021 19:06:38 +0100")
Message-ID: <875z3z50if.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45780
Cc: 45780 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> 1. when only annotation suffix string is provided, then the face
>>     completion-annotations is added;
>> 2. when both prefix and suffix are provided, then the client decides
>>     what face to add.  Also it's possible to provide an empty prefix
>>     string to be able to specify a custom face for the suffix string.
>> So when the client wants to override the default annotation face,
>> this is already easy to do using something like (this is not a patch
>> to commit, but just demonstration of current abilities):
>
> I would prefer the more automatic behaviour I proposed as having
> completion-annotations face is nice when the client has not thought about
> it but when the client has provided a string with a face it is likely the
> client wants exactly that face and not a combination with
> completion-annotations face. Basing the decision on a provided prefix seems
> a bit arbitrary and one would need to figure this out by looking at
> the code.

Do you want to use the completion-annotations face conditionally only
for annotations, i.e. when only the suffix is provided by the client?
Because when a prefix is provided as well, then it's not an annotation
anymore, so the completion-annotations face is not applicable to prefixes.

Doing this is not something new, we already have the same logic
in minibuffer-message:

    (unless (or (null minibuffer-message-properties)
                ;; Don't overwrite the face properties the caller has set
                (text-properties-at 0 message))
      (setq message (apply #'propertize message minibuffer-message-properties)))

Is this logic suitable for completion-annotations?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45780; Package emacs. Full text available.

Message received at 45780 <at> debbugs.gnu.org:


Received: (at 45780) by debbugs.gnu.org; 13 Jan 2021 18:06:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 13 13:06:50 2021
Received: from localhost ([127.0.0.1]:36530 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kzkXi-0000Su-Au
	for submit <at> debbugs.gnu.org; Wed, 13 Jan 2021 13:06:50 -0500
Received: from mout02.posteo.de ([185.67.36.66]:41601)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <clemera@HIDDEN>) id 1kzkXf-0000Sc-RX
 for 45780 <at> debbugs.gnu.org; Wed, 13 Jan 2021 13:06:48 -0500
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 8F17C2400FF
 for <45780 <at> debbugs.gnu.org>; Wed, 13 Jan 2021 19:06:41 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1610561201; bh=TSysYnFAdIOKWKp/bvUIi3PQQgP+ngxtGUuk8YUX4cs=;
 h=Subject:To:Cc:From:Date:From;
 b=mQ0PZ99edzUCxKbm5RdyBCA5jMM9Fvol+xOt/2USmnWlwKxyVcHuFGFM1RPb6e/sm
 P1jaPdMUzanpBmHqpqPO9MmZcrpmlZ0XIuOsG2g8y9T+LFpXepTEL/YADkHrrzX+Mt
 F5WgtBKo2pqAlsT9/XVelv//8hgCPkL8uejUhQzOrfv5/aafTF8IjGClKooeukRyzl
 zJGI0QpzG7PN3RQoRg3+G+Z1i69fuHRaaAqMt247tD57g7R7E2eHoJYclcPT8Nyw2a
 EhjTby4wrXV96vBox0gZCRFEd/4/BXve9dAjNo6SEmUx/9zVA39jvsu/BWhhR/Ohxs
 taD5VN1YExSkQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4DGFkm6W3cz9rxR;
 Wed, 13 Jan 2021 19:06:40 +0100 (CET)
Subject: Re: bug#45780: 28.0.50; [PATCH] Face used for affixation function
 annotations
To: Juri Linkov <juri@HIDDEN>
References: <9b1409af-58b9-3a62-4162-343fd25293ca@HIDDEN>
 <87ft378gjk.fsf@HIDDEN>
 <c8b4f5c8-1828-77e4-15f6-160c2bad1e25@HIDDEN>
 <8735z6xx11.fsf@HIDDEN>
From: Clemens <clemera@HIDDEN>
Message-ID: <7763f3e7-475c-9adb-ce62-7801faf47a90@HIDDEN>
Date: Wed, 13 Jan 2021 19:06:38 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
In-Reply-To: <8735z6xx11.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 45780
Cc: 45780 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)


> 1. when only annotation suffix string is provided, then the face
>     completion-annotations is added;
> 
> 2. when both prefix and suffix are provided, then the client decides
>     what face to add.  Also it's possible to provide an empty prefix
>     string to be able to specify a custom face for the suffix string.
> 
> So when the client wants to override the default annotation face,
> this is already easy to do using something like (this is not a patch
> to commit, but just demonstration of current abilities):

I would prefer the more automatic behaviour I proposed as having 
completion-annotations face is nice when the client has not thought 
about it but when the client has provided a string with a face it is 
likely the client wants exactly that face and not a combination with 
completion-annotations face. Basing the decision on a provided prefix 
seems a bit arbitrary and one would need to figure this out by looking 
at the code.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45780; Package emacs. Full text available.

Message received at 45780 <at> debbugs.gnu.org:


Received: (at 45780) by debbugs.gnu.org; 12 Jan 2021 18:51:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 12 13:51:17 2021
Received: from localhost ([127.0.0.1]:33125 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kzOlB-0003md-EI
	for submit <at> debbugs.gnu.org; Tue, 12 Jan 2021 13:51:17 -0500
Received: from relay8-d.mail.gandi.net ([217.70.183.201]:48465)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1kzOl6-0003mD-Jm
 for 45780 <at> debbugs.gnu.org; Tue, 12 Jan 2021 13:51:15 -0500
X-Originating-IP: 91.129.98.64
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 27E051BF20A;
 Tue, 12 Jan 2021 18:51:04 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Clemens <clemera@HIDDEN>
Subject: Re: bug#45780: 28.0.50; [PATCH] Face used for affixation function
 annotations
Organization: LINKOV.NET
References: <9b1409af-58b9-3a62-4162-343fd25293ca@HIDDEN>
 <87ft378gjk.fsf@HIDDEN>
 <c8b4f5c8-1828-77e4-15f6-160c2bad1e25@HIDDEN>
Date: Tue, 12 Jan 2021 20:30:54 +0200
In-Reply-To: <c8b4f5c8-1828-77e4-15f6-160c2bad1e25@HIDDEN> (Clemens's
 message of "Mon, 11 Jan 2021 21:07:57 +0100")
Message-ID: <8735z6xx11.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45780
Cc: 45780 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>>> 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?
>> Do you see any possible backward-compatibility issues with changing this
>> in
>> Emacs?  For example, when a package like Selectrum puts another face
>> on the completion string, then it will be displayed instead of the default
>> completion-annotations face.
>
> We already do this for annotations/affixations in Selectrum but only based
> on the face of the annotation/affixation itself, the completion string
> doesn't affect this. I hope this wouldn't have any visual downsides for old
> code which assumes the faces get merged but I haven't encountered any cases
> where code tried to apply custom faces to annotations besides the
> marginalia package. Letting the client control it makes it easier to
> configure the display as it's hard to predict what will come out of face
> merging with the face the user has configured as `completion-annotations`
> face. This new behaviour could also only be applied for affixation
> functions to avoid any possibly bad effects of existing code.

It seems the current logic already supports overriding faces for
completion strings:

1. when only annotation suffix string is provided, then the face
   completion-annotations is added;

2. when both prefix and suffix are provided, then the client decides
   what face to add.  Also it's possible to provide an empty prefix
   string to be able to specify a custom face for the suffix string.

So when the client wants to override the default annotation face,
this is already easy to do using something like (this is not a patch
to commit, but just demonstration of current abilities):

diff --git a/lisp/simple.el b/lisp/simple.el
index 4896a282ec..ca308d0bb6 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1969,7 +1969,7 @@ read-extended-command--affixation
                              (format " (%s)" (car obsolete)))
                             ((and binding (not (stringp binding)))
                              (format " (%s)" (key-description binding))))))
-         (if suffix (list command-name suffix) command-name)))
+         (if suffix (list command-name "" (propertize suffix 'face 'shadow)) command-name)))
      command-names)))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45780; Package emacs. Full text available.

Message received at 45780 <at> debbugs.gnu.org:


Received: (at 45780) by debbugs.gnu.org; 11 Jan 2021 20:08:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 11 15:08:07 2021
Received: from localhost ([127.0.0.1]:58356 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kz3Tz-00048K-HK
	for submit <at> debbugs.gnu.org; Mon, 11 Jan 2021 15:08:07 -0500
Received: from mout01.posteo.de ([185.67.36.65]:36863)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <clemera@HIDDEN>) id 1kz3Tx-00047m-6i
 for 45780 <at> debbugs.gnu.org; Mon, 11 Jan 2021 15:08:06 -0500
Received: from submission (posteo.de [89.146.220.130]) 
 by mout01.posteo.de (Postfix) with ESMTPS id A6BFF16005C
 for <45780 <at> debbugs.gnu.org>; Mon, 11 Jan 2021 21:07:58 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1610395678; bh=ApcUXNLVt09YYprXjh3m141ZP0oz8M1ODyUmtDXXgbw=;
 h=Subject:To:Cc:From:Date:From;
 b=GgGx5N9136Xe4hW5iCm1x/crdwLHbEw60gSoQu/4LuabocwkSGAnhJEkq+/shVERA
 YKi1z4pegyROT4pegOszTMKZGbppGwbL9uXb+6J6GgTb0t5kCtuRRJqAT/qo4TEsaB
 FaeoT5wG1Xsm2oicMKKChVEMuUMLXR2UO+H7zbgG/dis9cRSv6PEPlm5FCEtRBlx+X
 H4Cdcf92USFJLsGAzpi7UY/NxbP3AIOHjQZrQno+lqjmFLupyXchIAeI9TvmoR9PdX
 N2tpO1OXNjNyMAf5P3USATOF7XOO9a/2CqtZA7FUccD/n42mFWhVKWluEJzdYK09Rl
 7j5tOWywy+D2g==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4DF4Wf01PQz6tmh;
 Mon, 11 Jan 2021 21:07:57 +0100 (CET)
Subject: Re: bug#45780: 28.0.50; [PATCH] Face used for affixation function
 annotations
To: Juri Linkov <juri@HIDDEN>
References: <9b1409af-58b9-3a62-4162-343fd25293ca@HIDDEN>
 <87ft378gjk.fsf@HIDDEN>
From: Clemens <clemera@HIDDEN>
Message-ID: <c8b4f5c8-1828-77e4-15f6-160c2bad1e25@HIDDEN>
Date: Mon, 11 Jan 2021 21:07:57 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
In-Reply-To: <87ft378gjk.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 45780
Cc: 45780 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> 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.
> 
> Shouldn't then this code with font-lock-prepend-text-property
> be removed completely?  Since both prefix and suffix are non-nil,
> this makes code no-op.

You are right I assumed the suffix can also be nil but looking at the 
let binding earlier in the code this can't be the case when there is a 
prefix which is derived from the fact that there is a suffix annotation 
in the first place :)

>> 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))
> 
> So you propose to search for the face text-property in the provided string
> to decide whether to add the default face in completion--insert-strings?

Yes, the strings of the prefix/suffix.

>> 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?
> 
> Do you see any possible backward-compatibility issues with changing this in
> Emacs?  For example, when a package like Selectrum puts another face
> on the completion string, then it will be displayed instead of the default
> completion-annotations face.

We already do this for annotations/affixations in Selectrum but only 
based on the face of the annotation/affixation itself, the completion 
string doesn't affect this. I hope this wouldn't have any visual 
downsides for old code which assumes the faces get merged but I haven't 
encountered any cases where code tried to apply custom faces to 
annotations besides the marginalia package. Letting the client control 
it makes it easier to configure the display as it's hard to predict what 
will come out of face merging with the face the user has configured as 
`completion-annotations` face. This new behaviour could also only be 
applied for affixation functions to avoid any possibly bad effects of 
existing code.

> Thanks for noticing the documentation problem.  Do you think
> this fix is sufficient:

Looks good to me, too. Thank you!




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45780; Package emacs. Full text available.

Message received at 45780 <at> debbugs.gnu.org:


Received: (at 45780) by debbugs.gnu.org; 11 Jan 2021 19:01:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 11 14:01:00 2021
Received: from localhost ([127.0.0.1]:58264 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kz2R2-0002S6-23
	for submit <at> debbugs.gnu.org; Mon, 11 Jan 2021 14:01:00 -0500
Received: from relay9-d.mail.gandi.net ([217.70.183.199]:56497)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1kz2Qz-0002Rm-L5
 for 45780 <at> debbugs.gnu.org; Mon, 11 Jan 2021 14:00:58 -0500
X-Originating-IP: 91.129.98.64
Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64])
 (Authenticated sender: juri@HIDDEN)
 by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 3BDAAFF80C;
 Mon, 11 Jan 2021 19:00:49 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Clemens <clemera@HIDDEN>
Subject: Re: bug#45780: 28.0.50; [PATCH] Face used for affixation function
 annotations
Organization: LINKOV.NET
References: <9b1409af-58b9-3a62-4162-343fd25293ca@HIDDEN>
Date: Mon, 11 Jan 2021 20:38:55 +0200
In-Reply-To: <9b1409af-58b9-3a62-4162-343fd25293ca@HIDDEN> (Clemens's
 message of "Mon, 11 Jan 2021 13:38:13 +0100")
Message-ID: <87ft378gjk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 45780
Cc: 45780 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain

Hi Clemens,

> 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.

Shouldn't then this code with font-lock-prepend-text-property
be removed completely?  Since both prefix and suffix are non-nil,
this makes code no-op.

> 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))

So you propose to search for the face text-property in the provided string
to decide whether to add the default face in completion--insert-strings?

> 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?

Do you see any possible backward-compatibility issues with changing this in
Emacs?  For example, when a package like Selectrum puts another face
on the completion string, then it will be displayed instead of the default
completion-annotations face.

> 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.

Thanks for noticing the documentation problem.  Do you think
this fix is sufficient:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=affix-doc.patch

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 3eca9d066f..227966020c 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -122,7 +122,8 @@ completion-metadata
    returns a string to append to STRING.
 - `affixation-function': function to prepend/append a prefix/suffix to
    entries.  Takes one argument (COMPLETIONS) and should return a list
-   of completions with a list of three elements: completion, its prefix
+   of completions with a list of either two elements: completion
+   and suffix, or three elements: completion, its prefix
    and suffix.  This function takes priority over `annotation-function'
    when both are provided, so only this function is used.
 - `display-sort-function': function to sort entries in *Completions*.
@@ -1941,6 +1942,7 @@ completion-extra-properties
 `:affixation-function': Function to prepend/append a prefix/suffix to
    completions.  The function must accept one argument, a list of
    completions, and return a list where each element is a list of
+   either two elements: a completion, and a suffix, or
    three elements: a completion, a prefix and a suffix.
    This function takes priority over `:annotation-function'
    when both are provided, so only this function is used.

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#45780; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Jan 2021 12:38:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 11 07:38:25 2021
Received: from localhost ([127.0.0.1]:55992 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kywSn-0004OF-98
	for submit <at> debbugs.gnu.org; Mon, 11 Jan 2021 07:38:25 -0500
Received: from lists.gnu.org ([209.51.188.17]:44244)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <clemera@HIDDEN>) id 1kywSl-0004O7-DP
 for submit <at> debbugs.gnu.org; Mon, 11 Jan 2021 07:38:23 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:34842)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <clemera@HIDDEN>)
 id 1kywSk-0005ho-PR
 for bug-gnu-emacs@HIDDEN; Mon, 11 Jan 2021 07:38:23 -0500
Received: from mout02.posteo.de ([185.67.36.66]:51531)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <clemera@HIDDEN>)
 id 1kywSi-0007ZD-Ij
 for bug-gnu-emacs@HIDDEN; Mon, 11 Jan 2021 07:38:22 -0500
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 081FB240103
 for <bug-gnu-emacs@HIDDEN>; Mon, 11 Jan 2021 13:38:15 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1610368696; bh=j9Jv8u3iCSrfqKUGGdWganxxhT/0aKK9S7SL8t2ECQs=;
 h=To:Subject:From:Date:From;
 b=P4lnGkXhJxdN5EaaA9itaTprj2N4UeOZwVWr2QOJ8szAeH23d1tEKz15qzMOANvmt
 OAZ1aJsYiUSD4tKtUyGaWMLldM8ytEEcjQxiMN+wwWu2Fm3aMmt0HYkQvNHWE6NXoZ
 HqBrNiWCmKdh8alJAL3wotoHtdJRupRtLHxQCFaMqL5vNhbWtkH0PHaeo7EI1GKeB+
 +fpPaA53XGQfv9OiBcuwsRWvc5TE8glAla050L/vEBGBWBMSRnb+B0TpuauliVXeBT
 CsNZIjLTx/So3LPfHG8Jb5XgQuHTqINs0zbOhdkMR7ofowwe62SaMP5oojBCn3tNsR
 jrO2qA4pCQIBQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4DDtXk4jtsz6tmV
 for <bug-gnu-emacs@HIDDEN>; Mon, 11 Jan 2021 13:38:14 +0100 (CET)
To: bug-gnu-emacs@HIDDEN
Subject: 28.0.50; [PATCH] Face used for affixation function annotations
From: Clemens <clemera@HIDDEN>
Message-ID: <9b1409af-58b9-3a62-4162-343fd25293ca@HIDDEN>
Date: Mon, 11 Jan 2021 13:38:13 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------5BA9B8EA9FB8B9B8DA38CC0E"
Content-Language: en-US
Received-SPF: pass client-ip=185.67.36.66; envelope-from=clemera@HIDDEN;
 helo=mout02.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

This is a multi-part message in MIME format.
--------------5BA9B8EA9FB8B9B8DA38CC0E
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------5BA9B8EA9FB8B9B8DA38CC0E
Content-Type: text/x-patch; charset=UTF-8;
 name="affix.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="affix.patch"

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))

--------------5BA9B8EA9FB8B9B8DA38CC0E--




Acknowledgement sent to Clemens <clemera@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#45780; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 14 Jan 2021 19:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.