4

Is there a build of GUI Emacs for Mac that can display emoji? I tried this and AquaEmacs but neither of them could display it.

stacko
  • 1,577
  • 1
  • 11
  • 18

1 Answers1

9

The Emacs Mac Port is said to support emoji display out of the box:

  • Can display color bitmap fonts such as Apple Color Emoji, if compiled and executed on Mac OS X 10.7 or later. Also supports display of some combinations of regional indicator symbols, such as U+1F1EF followed by U+1F1F5, as national flags. Variation Selectors 15 (text-style) and 16 (emoji-style) are also supported. On OS X 10.10.3 and later, emoji modifiers for skin tones (U+1F3FB - U+1F3FF) are supported as well.

It's available in a Homebrew Tap. To enable the tap and install the port, type:

$ brew tap railwaycat/emacsmacport
$ brew install emacs-mac

Alternatively you can manually configure the Emacs' font choice to use Apple's Emoji font:

(set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji")
                  frame 'prepend)

Note that you'll need to apply this to every new frame, and thus call it in a function for after-make-frame-functions.

This should work on a normal Cocoa build of standard Emacs, e.g. from brew install emacs or Emacs for Mac OS X.

  • The Emacs Mac port by YAMAMOTO Mitsuharu is available in MacPorts too (run `port install emacs-mac-app`). – Constantine Feb 10 '16 at 16:15
  • I use the railwaycat port, and can confirm firsthand that it does display emoji in the Apple Color Emoji font. – Aaron Miller Feb 11 '16 at 19:57
  • Also, for the benefit of people who stumble on this question and are trying to make emoji work on something other than a Mac: [emacs-emojify](https://github.com/iqbalansari/emacs-emojify) is a cross-platform emoji library that includes a broad collection of (I presume) free emoji in .png format, and I find it works very nicely on Windows and Linux. – Aaron Miller Feb 11 '16 at 19:59
  • I tried Homebrew Tap but how can I run the installed railwaycat emacs? It's not supposed to run on Terminal, is it? If so, I wouldn't be able to click to navigate. I also tried the alternative method, adding a new function including the snippet you wrote and then hooking it to after-make-frame-functions in my init.el file, but didn't work? It just gives me an error saying "wrong number of arguments." – stacko Feb 12 '16 at 16:59
  • @stacko Like any other OS X application: Start the app bundle. Run `brew linkapps` to have it appear in Launchpad, etc. As for the alternative method, the error message doesn't help without seeing what you've done. Take a look at the docstring of `after-make-frame-functions` to figure out how it's supposed to be used. –  Feb 12 '16 at 17:02
  • How can I read the docstring of `after-make-frame-functions`? – stacko Feb 12 '16 at 17:19
  • @stacko Uh, `C-h v after-make-frame-functions`? –  Feb 12 '16 at 17:20
  • Isn't this what you meant in your alternative method?: `(add-hook 'after-make-frame-functions 'my-set-font) (defun my-set-font () (interactive) (set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji") frame 'prepend))` I tried this as I said earlier and it didn't work. Am I taking what you wrote in your answer wrong? – stacko Feb 12 '16 at 17:26
  • @stacko Please, do read the docstring. You'll see that the function is supposed to take an argument, namely the `frame`. –  Feb 12 '16 at 17:28
  • It worked, thanks! But how could you know that it's supposed to take "frame" as an argument? I looked at the docstring but it just said `after-make-frame-functions is a variable defined in ``frame.el'. Its value is (my-set-font select-frame)` Does the `select-frame` part mean it needs an argument `frame`? – stacko Feb 12 '16 at 17:36
  • Oh, sorry. It did say `The functions are run with one arg, the newly created frame` after that. : `This variable may be risky if used as a file-local variable. Documentation: Functions to run after a frame is created. The functions are run with one arg, the newly created frame.` – stacko Feb 12 '16 at 17:41
  • I found I had to run something like `(mapc '(lambda (f) (set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji") f 'prepend)) (frame-list))` to apply this to the initially created frame. – Winny Oct 29 '21 at 15:44