From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Clemens Newsgroups: gmane.emacs.bugs Subject: bug#45780: 28.0.50; [PATCH] Face used for affixation function annotations Date: Mon, 11 Jan 2021 13:38:13 +0100 Message-ID: <9b1409af-58b9-3a62-4162-343fd25293ca@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------5BA9B8EA9FB8B9B8DA38CC0E" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8421"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 To: 45780@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 11 13:41:36 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 1kywVr-00026E-Pd for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 13:41:35 +0100 Original-Received: from localhost ([::1]:53368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kywVq-0007DH-RX for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 07:41:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kywTP-0005tp-0z for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 07:39:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44446) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kywTO-0007im-P8 for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 07:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kywTO-0004PY-N6 for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 07:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Clemens Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Jan 2021 12:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45780 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161036870516883 (code B ref -1); Mon, 11 Jan 2021 12:39:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Jan 2021 12:38:25 +0000 Original-Received: from localhost ([127.0.0.1]:55992 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kywSn-0004OF-98 for submit@debbugs.gnu.org; Mon, 11 Jan 2021 07:38:25 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:44244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kywSl-0004O7-DP for submit@debbugs.gnu.org; Mon, 11 Jan 2021 07:38:23 -0500 Original-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 ) id 1kywSk-0005ho-PR for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 07:38:23 -0500 Original-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 ) id 1kywSi-0007ZD-Ij for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 07:38:22 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 081FB240103 for ; 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== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4DDtXk4jtsz6tmV for ; Mon, 11 Jan 2021 13:38:14 +0100 (CET) Content-Language: en-US Received-SPF: pass client-ip=185.67.36.66; envelope-from=clemera@posteo.net; 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-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:197690 Archived-At: 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--