Homepage: https://codeberg.org/egirl/company-emoji
Author: Alex Dunn
Updated:
Company-mode backend for emoji
company-mode backend providing autocompletion for emoji. đđŠ
## setup
Add `company-emoji.el` to your load-path, then add something like the
following to your init file:
```elisp
(require 'company-emoji)
(add-to-list 'company-backends 'company-emoji)
```
After selecting an emoji-word from the completion-list, it will be
replaced by the real unicode emoji (`:cactus:` becomes đ”, `:cat:`
becomes đ±, etc.)
### emoji font support
If youâre on Linux, or on Mac OS X and using the Cocoa version of
Emacs (i.e., if built `â-with-ns`, or `--with-cocoa` using Homebrew),
youâll need to add something like this to your init file (thanks to
[@syohex](https://github.com/syohex) and
[@waymondo](https://github.com/waymondo)):
```elisp
(defun --set-emoji-font (frame)
"Adjust the font settings of FRAME so Emacs can display emoji properly."
(if (eq system-type 'darwin)
;; For NS/Cocoa
(set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji") frame 'prepend)
;; For Linux
(set-fontset-font t 'symbol (font-spec :family "Symbola") frame 'prepend)))
;; For when Emacs is started in GUI mode:
(--set-emoji-font nil)
;; Hook for when a frame is created with emacsclient
;; see https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Frames.html
(add-hook 'after-make-frame-functions '--set-emoji-font)
```
[Symbola](https://zhm.github.io/symbola/) can be installed with `apt-get`:
```sh
apt-get install ttf-ancient-fonts
```
**NB:** The `set-fontset-font` function is apparently only available
when Emacs has been compiled with a window system.
### custom variables
#### aliases
You can add shortcode aliases by modifying `company-emoji-aliases`.
Run `M-x customize-variable [RET] company-emoji-aliases` to bring up
company-emojiâs customization pane, then add or remove aliases to your
taste:
```
Hide Company Emoji Aliases:
[INS] [DEL] Symbol: :woman_man_holding_hands:
String: :couple:
[INS]
```
(âSymbolâ designates the user-defined alias, and âstringâ designates
the original shortcode you want your alias to mimick.)
Occasionally new default aliases may be added. If youâre upgrading
and have modified the `company-emoji-aliases` variable, the new
aliases will be ignored; youâll need to add them manually.
#### unicode replacement
By default, `:cat:` is replaced with đ± upon completion, but that can
be turned off by setting the variable `company-emoji-insert-unicode`
to `nil`.
## contributing
Contributions are very welcome! But please donât edit
`company-emoji-list.el` directly: itâs generated by
`build/generate_list.rb`, so you should modify that build script then
run `make company-emoji-list.el`.