unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45780: 28.0.50; [PATCH] Face used for affixation function annotations
@ 2021-01-11 12:38 Clemens
  2021-01-11 18:38 ` Juri Linkov
  0 siblings, 1 reply; 12+ messages in thread
From: Clemens @ 2021-01-11 12:38 UTC (permalink / raw)
  To: 45780

[-- Attachment #1: Type: text/plain, Size: 1174 bytes --]

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

[-- Attachment #2: affix.patch --]
[-- Type: text/x-patch, Size: 645 bytes --]

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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-01-31  9:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 12:38 bug#45780: 28.0.50; [PATCH] Face used for affixation function annotations Clemens
2021-01-11 18:38 ` Juri Linkov
2021-01-11 20:07   ` Clemens
2021-01-12 18:30     ` Juri Linkov
2021-01-13 18:06       ` Clemens
2021-01-14  9:00         ` Juri Linkov
2021-01-14 17:21           ` Clemens
2021-01-14 18:59             ` Juri Linkov
2021-01-14 19:43               ` Clemens
2021-01-25 18:02                 ` Juri Linkov
2021-01-30 19:13                   ` Juri Linkov
2021-01-31  9:36                     ` Clemens

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).