Function: emoji--base-name

emoji--base-name is a byte-compiled function defined in emoji.el.gz.

Signature

(emoji--base-name NAME DERIVATIONS)

Source Code

;; Defined in /usr/src/emacs/lisp/international/emoji.el.gz
(defun emoji--base-name (name derivations)
  (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)))