[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/emoji 6b3224f: Split up too-long lists of emojis (only the flags
From: |
Lars Ingebrigtsen |
Subject: |
scratch/emoji 6b3224f: Split up too-long lists of emojis (only the flags currently) |
Date: |
Tue, 26 Oct 2021 12:03:56 -0400 (EDT) |
branch: scratch/emoji
commit 6b3224fe40f4e6915de2fc8c6f706b9187ed9825
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Split up too-long lists of emojis (only the flags currently)
---
lisp/play/emoji.el | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/lisp/play/emoji.el b/lisp/play/emoji.el
index a037e6d..b457e35 100644
--- a/lisp/play/emoji.el
+++ b/lisp/play/emoji.el
@@ -73,7 +73,9 @@
(setq range-start nil))
(list (string char)))
do (setq prev char))
- main sub)))))
+ main sub)))
+ ;; Finally split up the too-long lists.
+ (emoji--split-long-lists emoji--labels)))
(defun emoji--add-characters (chars main sub)
(let ((subs (if (member sub '( "cat-face" "monkey-face" "skin-tone"
@@ -97,8 +99,8 @@
(when (and (= (length subs) 1)
(not (string-search "-" (car subs))))
(setq subs nil)))
- (when (equal (car subs) "person")
- (pop subs))
+ (when (equal (car subs) "person")
+ (pop subs))
;; Useless category.
(unless (member main '("Skin-Tone"))
(unless (setq parent (assoc main emoji--labels))
@@ -132,7 +134,8 @@
(cl-loop for char in alist
for i in (append (number-sequence ?a ?z)
(number-sequence ?A ?Z)
- (number-sequence ?0 ?9))
+ (number-sequence ?0 ?9)
+ (number-sequence ?! ?/))
collect (let ((this-char char))
(list (string i)
char
@@ -201,6 +204,21 @@ We prefer the earliest unique letter."
append (emoji--flatten child))
(list alist)))
+(defun emoji--split-long-lists (alist)
+ (let ((whole alist))
+ (pop alist)
+ (if (consp (cadr alist))
+ ;; Descend.
+ (cl-loop for child in alist
+ do (emoji--split-long-lists child))
+ ;; We have a list.
+ (when (length> alist 77)
+ (setcdr whole
+ (cl-loop for prefix from ?a
+ for bit on alist by (lambda (l) (nthcdr 77 l))
+ collect (cons (concat (string prefix) "-group")
+ (seq-take bit 77))))))))
+
(provide 'emoji)
;;; emoji.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- scratch/emoji 6b3224f: Split up too-long lists of emojis (only the flags currently),
Lars Ingebrigtsen <=