emacs-diffs
[Top][All Lists]
Advanced

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

scratch/emoji 9f0fe1b: Get VS-16 stuff right


From: Lars Ingebrigtsen
Subject: scratch/emoji 9f0fe1b: Get VS-16 stuff right
Date: Tue, 26 Oct 2021 14:09:07 -0400 (EDT)

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

    Get VS-16 stuff right
---
 lisp/play/emoji.el | 42 +++++++++++++++++++++++++++---------------
 1 file changed, 27 insertions(+), 15 deletions(-)

diff --git a/lisp/play/emoji.el b/lisp/play/emoji.el
index 9aa4ec1..afd1733 100644
--- a/lisp/play/emoji.el
+++ b/lisp/play/emoji.el
@@ -144,7 +144,18 @@
           (nconc parent (list (setq elem (list (car subs))))))
         (pop subs)
         (setq parent elem))
-      (nconc elem chars))))
+      (nconc elem
+             (cl-loop for char in chars
+                      collect (if (and (= (length char) 1)
+                                       (eq (aref char-script-table (elt char 
0))
+                                           'symbol))
+                                  ;; If itʼs not in the 'emoji script you need
+                                  ;; the VS-16. Itʼs an emoji, but it
+                                  ;; has Emoji_Presentation = No.
+                                  ;; Donʼt ask.  Add VARIATION
+                                  ;; SELECTOR-16.
+                                  (concat char (string  #xfe0f))
+                                char))))))
 
 (defun emoji--define-transient (&optional alist)
   (unless alist
@@ -169,20 +180,21 @@
                                       (number-sequence ?0 ?9)
                                       (number-sequence ?! ?/))
                      collect (let ((this-char char))
-                               (list (string i)
-                                     char
-                                     (let ((variants
-                                            (gethash char emoji--variants)))
-                                       (if variants
-                                           ;; We have a variant, so add
-                                           ;; another level.
-                                           (emoji--define-transient
-                                            (cons (concat mname " " char)
-                                                  variants))
-                                         ;; Insert the emoji.
-                                         (lambda ()
-                                           (interactive)
-                                           (insert this-char)))))))))
+                               (list
+                                (string i)
+                                char
+                                (let ((variants
+                                       (gethash char emoji--variants)))
+                                  (if variants
+                                      ;; We have a variant, so add
+                                      ;; another level.
+                                      (emoji--define-transient
+                                       (cons (concat mname " " char)
+                                             variants))
+                                    ;; Insert the emoji.
+                                    (lambda ()
+                                      (interactive)
+                                      (insert this-char)))))))))
          (args (apply #'vector mname
                       (emoji--columnize layout
                                         (if has-subs 2 10)))))



reply via email to

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