From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#45780: 28.0.50; [PATCH] Face used for affixation function annotations Date: Tue, 12 Jan 2021 20:30:54 +0200 Organization: LINKOV.NET Message-ID: <8735z6xx11.fsf@mail.linkov.net> References: <9b1409af-58b9-3a62-4162-343fd25293ca@posteo.net> <87ft378gjk.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35000"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 45780@debbugs.gnu.org To: Clemens Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 12 20:19:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzPCB-0008z7-2s for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Jan 2021 20:19:11 +0100 Original-Received: from localhost ([::1]:48688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzPCA-0003uj-07 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Jan 2021 14:19:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzOlv-0008Rz-W2 for bug-gnu-emacs@gnu.org; Tue, 12 Jan 2021 13:52:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49823) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzOlv-0004Aq-PA for bug-gnu-emacs@gnu.org; Tue, 12 Jan 2021 13:52:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kzOlv-0003oU-O7 for bug-gnu-emacs@gnu.org; Tue, 12 Jan 2021 13:52:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Jan 2021 18:52:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45780 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45780-submit@debbugs.gnu.org id=B45780.161047747714552 (code B ref 45780); Tue, 12 Jan 2021 18:52:03 +0000 Original-Received: (at 45780) by debbugs.gnu.org; 12 Jan 2021 18:51:17 +0000 Original-Received: from localhost ([127.0.0.1]:33125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzOlB-0003md-EI for submit@debbugs.gnu.org; Tue, 12 Jan 2021 13:51:17 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:48465) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzOl6-0003mD-Jm for 45780@debbugs.gnu.org; Tue, 12 Jan 2021 13:51:15 -0500 X-Originating-IP: 91.129.98.64 Original-Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64]) (Authenticated sender: juri@linkov.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 27E051BF20A; Tue, 12 Jan 2021 18:51:04 +0000 (UTC) In-Reply-To: (Clemens's message of "Mon, 11 Jan 2021 21:07:57 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:197837 Archived-At: >>> 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)))