Emacs & Emojis: A ❤️ Story

Emacs grew support for displaying colour emojis recently (and this is included in the release branch, which will become Emacs 28.1 in some months). This includes support for the grapheme cluster emojis (that consist of a number of Unicode code points, joined together with zero-width joiners and magic).

So finally Emacs can display all of these things. You can thank Robert Pluim, who did all the actual work.

But Emacs still didn’t have any convenient way to insert emojis, and I thought that was sad. I mean, I’m not really the right person to be worrying about emojis, since I have barely used anything more complicated than 😀 myself in my entire life. But on the other hand, perhaps that gives a fresh perspective? Probably not, but I couldn’t sleep on Monday night, so I sat up until dawn and typed away until I had something.

And then I’ve spent a little bit of time staring at it and polishing it up.

So — tada:

There’s three different commands, bound to ‘C-x 8 e e’, ‘C-x 8 e s’ and ‘C-x 8 e l’ — enter, search and list, respectively.

The first interface uses Jonas Bernoulli’s Transient package to display a series of “menus” that you can navigate. (The categories come straight from the Unicode data set, and has only been tweaked lightly.)

The second interface allows you to search for the emoji by name — which can be convenient if you know exactly which emoji you want.

Finally, the last interface is for the opposite situation: Where you have no idea what you want. So it just lists all the emojis. Well, not all all — the hue/gender variants are still behind a menu selector, for those emojis that have those. And then you click on the one you want.

This probably won’t be in Emacs 28.1, though, but is targeting Emacs 29.1 instead, since it’s really too late in the release cycle to include it. But we’ll see. It’ll land on the trunk this weekend, in any case. (It’s currently in the scratch/emoji branch, if you want to have a look at it.)

But most importantly, I definitely foresee huge increases to efficiency when programming:

Look how much more understandable the code is. Finally we have actually literate programming!

19 thoughts on “Emacs & Emojis: A ❤️ Story”

  1. Niice. Any chance it can be a package in the meantime? I’m planning to mention emoji support as one of the cool things in Emacs 28 in my Emacs News Highlights talk, so I’d be happy to plug it!

    1. Making it into a package would be good, but we still haven’t totally decided whether to just put it into Emacs 28.1 or not. If we don’t do that, then we’ll be making it into a package. (It doesn’t work on older Emacs versions than Emacs 28 anyway.)

  2. I was concentrating so much on what could be done that I never stopped to ask if I should be doing it. What have we unleashed? 😉

  3. Dude, it’s not 1950 anymore. Who uses Emacs? People have moved on and use VS Code, Sublime and Atom. We have 4k screens now. We don’t have 80 columns bro, if you haven’t noticed.

  4. What is the elisp way to split a string of emoji characters that may include emoji glued together by magic into individual graphemes?

  5. Thanks. It works on regular emoji, but I can’t get it to work on this one: (string-glyph-split “✈️🌍”)

Leave a Reply to larsmagne23Cancel reply