Site icon Random Thoughts

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:

https://lars.ingebrigtsen.no/wp-content/uploads/2021/10/emoji1.mp4

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:

https://lars.ingebrigtsen.no/wp-content/uploads/2021/10/emoji4.mp4

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

Exit mobile version