emacs-diffs
[Top][All Lists]
Advanced

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

scratch/emoji 50080e2: Make the emojis that have derivations stand out


From: Lars Ingebrigtsen
Subject: scratch/emoji 50080e2: Make the emojis that have derivations stand out
Date: Tue, 26 Oct 2021 20:31:40 -0400 (EDT)

branch: scratch/emoji
commit 50080e26dae4e0005b9d2694be5fea95a348bec9
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make the emojis that have derivations stand out
---
 lisp/play/emoji.el | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/lisp/play/emoji.el b/lisp/play/emoji.el
index 8d73c6e..dfcef30 100644
--- a/lisp/play/emoji.el
+++ b/lisp/play/emoji.el
@@ -32,9 +32,17 @@
   :version "29.1"
   :group 'play)
 
-(defface emoji-list-header-face
+(defface emoji-list-header
   '((default :weight bold :inherit variable-pitch))
-  "Face for web pages with invalid certificates."
+  "Face for emoji list headers."
+  :version "29.1")
+
+(defface emoji-with-derivations
+  '((((background dark))
+     (:background "#202020"))
+    (((background light))
+     (:background "blue")))
+  "Face for emojis that have derivations."
   :version "29.1")
 
 (defvar emoji--labels nil)
@@ -86,19 +94,24 @@ when the command was issued."
                 alist)
       ;; Output this block of emojis.
       (insert (propertize (concat name " " mname)
-                          'face 'emoji-list-header-face)
+                          'face 'emoji-list-header)
               "\n\n")
       (cl-loop for i from 1
                for char in alist
                do (insert
                    (propertize
-                    char
+                    (emoji--fontify-char char)
                     'emoji-glyph char
                     'help-echo (emoji--name char)))
                (when (zerop (mod i width))
                  (insert "\n")))
       (insert "\n\n"))))
 
+(defun emoji--fontify-char (char)
+  (if (gethash char emoji--derived)
+      (propertize char 'face 'emoji-with-derivations)
+    char))
+
 (defun emoji--name (char)
   (or (gethash char emoji--names)
       (get-char-code-property (aref char 0) 'name)))
@@ -337,7 +350,7 @@ when the command was issued."
                      collect (let ((this-char char))
                                (list
                                 (string i)
-                                char
+                                (emoji--fontify-char char)
                                 (let ((derived
                                        (and (not inhibit-derived)
                                             (not (gethash char



reply via email to

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