[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master df3fde6: Further fixes for emojis in the "people" categories
From: |
Lars Ingebrigtsen |
Subject: |
master df3fde6: Further fixes for emojis in the "people" categories |
Date: |
Sun, 19 Dec 2021 13:53:13 -0500 (EST) |
branch: master
commit df3fde6fa5366d02fb41d98962df0b2e1148d5b2
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Further fixes for emojis in the "people" categories
* lisp/international/emoji.el (emoji--base-name): Get more derived
categories right.
---
lisp/international/emoji.el | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index d0e9068..4375a63 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -412,18 +412,26 @@ the name is not known."
(write-region (point-min) (point-max) file)))
(defun emoji--base-name (name derivations)
- (let* ((base (replace-regexp-in-string ":.*" "" name))
- (non-binary (replace-regexp-in-string "\\`\\(man\\|woman\\) " ""
- base)))
- ;; If we have (for instance) "person golfing", and we're adding
- ;; "man golfing", make the latter a derivation of the former.
- (cond
- ((gethash (concat "person " non-binary) derivations)
- (concat "person " non-binary))
- ((gethash non-binary derivations)
- non-binary)
- (t
- base))))
+ (let* ((base (replace-regexp-in-string ":.*" "" name)))
+ (catch 'found
+ ;; If we have (for instance) "person golfing", and we're adding
+ ;; "man golfing", make the latter a derivation of the former.
+ (let ((non-binary (replace-regexp-in-string
+ "\\`\\(m[ae]n\\|wom[ae]n\\) " "" base)))
+ (dolist (prefix '("person " "people " ""))
+ (let ((key (concat prefix non-binary)))
+ (when (gethash key derivations)
+ (throw 'found key)))))
+ ;; We can also have the gender at the end of the string, like
+ ;; "merman" and "pregnant woman".
+ (let ((non-binary (replace-regexp-in-string
+ "\\(m[ae]n\\|wom[ae]n\\|maid\\)\\'" "" base)))
+ (dolist (suffix '(" person" "person" ""))
+ (let ((key (concat non-binary suffix)))
+ (when (gethash key derivations)
+ (throw 'found key)))))
+ ;; Just return the base.
+ base)))
(defun emoji--split-subgroup (subgroup)
(let ((prefixes '("face" "hand" "person" "animal" "plant"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master df3fde6: Further fixes for emojis in the "people" categories,
Lars Ingebrigtsen <=