Skip to content

Emoji insertion in Emacs using Discord's emoji shortcodes

License

Notifications You must be signed in to change notification settings

srithon/discord-emoji.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

discord-emoji

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.

./usage.gif

Installation

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")))

Configuration

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))

Configuration

Custom Shortcode Aliases

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")))

./aliases_demo.gif

Customize Faces

You can also configure the discord-emoji-category face to change how the category annotation is displayed.

Implementation Details

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.

Future Plans

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.

About

Emoji insertion in Emacs using Discord's emoji shortcodes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published