Skip to main content

C'est la Z

Learning Elisp 11 - Emoji Replace Part 1

Back from my trip and ready to continue the elisp series.

Today we're starting our emoji project. When we're done we'll have a minor mode where we can type in something like 🐘 in a buffer and Emacs will replace it with the elephant emoji 🐘. That's part one. We'll then learn how to overlay the emoji over the text so that while it will appear as the emoji (🐘) the actual text of 🐘 will still be in the buffer and file if you save it. The former, replacing the text with the emoji is useful if you actually want the emoji in the file. I'm using it to create emoji based polls that I can cut and paste into Slack or Zulip. The overlay idea is useful when you want the emoji to display for visual effect but you don't want it in the actual file.

There's no new elisp in this first video - we're going to put together a function that sees if you type an emoji name before the current point (cursor) and if so, replaces it with the emoji. The function pulls together a lot of what was covered in earlier videos.

So, no code explanations here. The second video will deal with hooks - the way we'll make this all happen "automatically" and then we'll cover the overlays and then finally making minor mode and configuration.

Enjoy.

Code:

The code for the series is still up here:

comments powered by Disqus