bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45780: 28.0.50; [PATCH] Face used for affixation function annotation


From: Juri Linkov
Subject: bug#45780: 28.0.50; [PATCH] Face used for affixation function annotations
Date: Mon, 25 Jan 2021 20:02:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> I agree its purpose is quite different from the example above.
>> Then maybe something like this should do what you want:
>
> Yes, that would be nice if you also think it would be okay to change it
> this way, thank you!

To make sure that everything is right, here is a brief table
for coming changes, where overriden-face is a face specified
by the client:

#+begin_quote
| prefix | suffix | overriden-face | result face             |
|--------+--------+----------------+-------------------------+
|    N   |    Y   |       N        | completions-annotations on suffix
|    Y   |    N   |       N        | no face
|    Y   |    Y   |       N        | no face
|    N   |    Y   |       Y        | overriden-face on suffix
|    Y   |    N   |       Y        | overriden-face on prefix
|    Y   |    Y   |       Y        | overriden-face on prefix and suffix
#+end_quote

Or maybe better to represent this as a test:

diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index 3ebca14a28..7349b191ca 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -1,4 +1,4 @@
-;;; completion-tests.el --- Tests for completion functions  -*- 
lexical-binding: t; -*-
+;;; minibuffer-tests.el --- Tests for completion functions  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
 
@@ -107,5 +107,23 @@ completion-table-test-quoting
                                                 nil (length input))
                      (cons output (length output)))))))
 
-(provide 'completion-tests)
-;;; completion-tests.el ends here
+(ert-deftest completion--insert-strings-faces ()
+  (with-temp-buffer
+    (completion--insert-strings
+     '(("completion1" "suffix1")))
+    (should (equal (get-text-property 12 'face) '(completions-annotations))))
+  (with-temp-buffer
+    (completion--insert-strings
+     '(("completion1" #("suffix1" 0 7 (face shadow)))))
+    (should (equal (get-text-property 12 'face) 'shadow)))
+  (with-temp-buffer
+    (completion--insert-strings
+     '(("completion1" "prefix1" "suffix1")))
+    (should (equal (get-text-property 19 'face) nil)))
+  (with-temp-buffer
+    (completion--insert-strings
+     '(("completion1" "prefix1" #("suffix1" 0 7 (face shadow)))))
+    (should (equal (get-text-property 19 'face) 'shadow))))
+
+(provide 'minibuffer-tests)
+;;; minibuffer-tests.el ends here

reply via email to

[Prev in Thread] Current Thread [Next in Thread]