Subject: bug#54441: 28.0.92; set-language-environment causes Apple Color Emoji cannot show up

From: Eli Zaretskii <[email-masked]>
Date: Fri, 18 Mar 2022 08:51:26 +0200

> From: Will Chang <[email-masked]>
> Date: Fri, 18 Mar 2022 11:41:00 +0800
> 
> (set-fontset-font "fontset-default" 'unicode "Apple Color Emoji" nil 'prepend)
> 
> (set-language-environment "UTF-8")
> 
> Steps to reproduce:
> 1. eval-buffer and the emoji doesn't show up correctly.
> 2. Comment out (set-language-environment "UTF-8") and run eval-buffer
> the emoji shows up correctly.

Please tell:

  . does this happen in "emacs -Q", if you evaluate the above
    immediately upon entering Emacs?
  . what is the language environment before the evaluation of
    set-language-environment above?
  . what is the output of "M-x describe-fontset RET fontset-default RET"
    after evaluating set-language-environment, in particular in the
    Emoji block starting from #x1F600?
  . what did you mean by "emoji doesn't show up correctly"? how was it
    displayed "incorrectly"?

And I have 2 comments, which may or may not be relevant to this issue:

 1) It is a very bad idea to do the likes of

    (set-fontset-font "fontset-default" 'unicode "Apple Color Emoji" nil 'prepend)

    That's because the character set 'unicode spans the entire range
    of Unicode characters, and there's no single font that can
    possibly support all of those characters.

 2) You should set the language environment _before_ any other
    customizations related to character sets and fonts, because the
    language environment affects those customizations.

Thanks.