Let’s bring Discord’s emoji insertion into Emacs!
As someone accustomed to Discord’s emoji shortcodes, I’ve become tired with Emacs’s existing emoji insertion methods, most of which use the verbose Emoji names defined in the Unicode spec, like face with tears of joy
instead of Discord’s much simpler :joy:
(😂).
Also, certain emojis have completely different names under Discord, like :sob:
compared to loudly crying face
(😭); overall, having to relearn the emoji names to insert them in Emacs is not ideal.
This package is not yet on MELPA, so using straight.el
you will need to include a recipe:
(package! discord-emoji
:recipe (:host github :repo "srithon/discord-emoji.el"
:files ("discord-emoji.el" "emojis.json")))
To use the package, simply bind a key combination to discord-emoji-insert
.
I’m using Doom Emacs (with Evil Mode), so my configuration looks like this:
(use-package! discord-emoji
:defer
:config
(map! :desc "Opens emoji insertion menu."
:i "M-e"
#'discord-emoji-insert))
The main configuration offered is the discord-emoji-custom-aliases
variable, which allows you to define your own aliases for Discord’s emoji shortcodes.
Here’s an example definition, which lets you search for each cdr
by typing each car
.
(setq discord-emoji-custom-aliases
'(("yikes" . "face_with_spiral_eyes")
("frazzled" . "confounded")
("huh" . "face_with_raised_eyebrow")))
You can also configure the discord-emoji-category
face to change how the category annotation is displayed.
After searching the internet, I found this issue on the discord-api-docs repository, where someone linked this JSON containing Discord’s emoji mappings. To be safe, in case the URL goes dead, I’ve included the JSON source in this repository.
Down the line, it would be interesting to extend this project to a completion-at-point source or company backend. These would arguably interrope better with the standard Emacs experience, but I would personally continue to use the current input method.