All Projects → iqbalansari → Emacs Emojify

iqbalansari / Emacs Emojify

Licence: gpl-3.0
Display emojis in Emacs

Programming Languages

elisp
30 projects

Projects that are alternatives of or similar to Emacs Emojify

Org Superstar Mode
Make org-mode stars a little more super
Stars: ✭ 271 (-10.56%)
Mutual labels:  emacs
Zetteldeft
A Zettelkasten system! Or rather, some functions on top of the emacs deft package.
Stars: ✭ 284 (-6.27%)
Mutual labels:  emacs
Company Coq
A Coq IDE build on top of Proof General's Coq mode
Stars: ✭ 297 (-1.98%)
Mutual labels:  emacs
Cloudmacs
Selfhost your Emacs and access it in browser
Stars: ✭ 277 (-8.58%)
Mutual labels:  emacs
Radian
🍉 Dotfiles that marry elegance and practicality.
Stars: ✭ 274 (-9.57%)
Mutual labels:  emacs
Rogue
Personal Emacs config
Stars: ✭ 286 (-5.61%)
Mutual labels:  emacs
Emacs Theme Darktooth
Darktooth : From the darkness... it watches.
Stars: ✭ 270 (-10.89%)
Mutual labels:  emacs
Suggest.el
discover elisp functions that do what you want
Stars: ✭ 302 (-0.33%)
Mutual labels:  emacs
Spacehammer
Hammerspoon config inspired by Spacemacs
Stars: ✭ 280 (-7.59%)
Mutual labels:  emacs
Vue Mode
Emacs major mode for vue.js
Stars: ✭ 290 (-4.29%)
Mutual labels:  emacs
Objed
Navigate and edit text objects with Emacs. Development on pause.
Stars: ✭ 276 (-8.91%)
Mutual labels:  emacs
Dotfiles
●📄 Ryan McGeary's configuration shiznit that makes him productive
Stars: ✭ 278 (-8.25%)
Mutual labels:  emacs
Helm
Emacs incremental completion and selection narrowing framework
Stars: ✭ 3,109 (+926.07%)
Mutual labels:  emacs
Ivy Rich
More friendly interface for ivy.
Stars: ✭ 274 (-9.57%)
Mutual labels:  emacs
Emax64
64-bit Emacs for Windows with ImageMagick 7
Stars: ✭ 301 (-0.66%)
Mutual labels:  emacs
Emacs.d
My emacs configuration documented in literate programming style
Stars: ✭ 271 (-10.56%)
Mutual labels:  emacs
Helm Projectile
Helm UI for Projectile
Stars: ✭ 285 (-5.94%)
Mutual labels:  emacs
Themecreator
https://mswift42.github.io/themecreator/ create themes for intellij, textmate, atom, emacs, vim and gnome terminal.
Stars: ✭ 303 (+0%)
Mutual labels:  emacs
Cider
The Clojure Interactive Development Environment that Rocks for Emacs
Stars: ✭ 3,229 (+965.68%)
Mutual labels:  emacs
Fountain Mode
Emacs major mode for screenwriting in Fountain plain-text markup
Stars: ✭ 288 (-4.95%)
Mutual labels:  emacs
  • Emojify

[[./CHANGELOG.org][file:https://img.shields.io/badge/version-v0.4-blue.svg]] [[https://melpa.org/#/emojify][file:https://melpa.org/packages/emojify-badge.svg]] [[http://stable.melpa.org/#/emojify][file:http://stable.melpa.org/packages/emojify-badge.svg]] [[https://travis-ci.org/iqbalansari/emacs-emojify][https://travis-ci.org/iqbalansari/emacs-emojify.svg?branch=master]] [[https://coveralls.io/github/iqbalansari/emacs-emojify?branch=master][https://coveralls.io/repos/github/iqbalansari/emacs-emojify/badge.svg?branch=master]] [[http://www.gnu.org/licenses/gpl-3.0.html][http://img.shields.io/:license-gpl3-blue.svg]] [[http://makeapullrequest.com][file:https://img.shields.io/badge/PRs-welcome-brightgreen.svg]]

** Table of contents :TOC_3_gh:

  • [[#emojify][Emojify]]
    • [[#what-is-this][What is this?]]
    • [[#what-does-it-look-like][What does it look like?]]
    • [[#requirements][Requirements]]
    • [[#installation][Installation]]
      • [[#elpa][ELPA]]
    • [[#usage][Usage]]
      • [[#displaying-emojis][Displaying emojis]]
      • [[#searching-emojis][Searching emojis]]
      • [[#inserting-emojis][Inserting emojis]]
      • [[#describing-emojis][Describing emojis]]
      • [[#listing-all-emojis][Listing all emojis]]
    • [[#customizations][Customizations]]
      • [[#displaying-composed-text-as-emojis][Displaying composed text as emojis]]
      • [[#displaying-emojis-in-company-mode-tooltips][Displaying emojis in company mode tooltips]]
      • [[#configuring-the-types-of-emojis-displayed][Configuring the types of emojis displayed]]
      • [[#configuring-how-emojis-are-displayed][Configuring how emojis are displayed]]
      • [[#configuring-the-buffers-where-emojify-mode-is-enabled][Configuring the buffers where emojify mode is enabled]]
      • [[#configuring-the-texts-that-are-displayed-as-emojis][Configuring the texts that are displayed as emojis]]
      • [[#customizing-the-behaviour-when-point-enters-an-emoji][Customizing the behaviour when point enters an emoji]]
      • [[#customizing-the-behaviour-during-isearch-mode][Customizing the behaviour during isearch-mode]]
      • [[#customizing-the-behaviour-when-mouse-hovers-over-an-emoji][Customizing the behaviour when mouse hovers over an emoji]]
      • [[#custom-emojis][Custom emojis]]
    • [[#known-issues][Known issues]]
    • [[#contributing][Contributing]]
    • [[#thanks][Thanks]]
    • [[#credits][Credits]]
    • [[#licence][Licence]]
      • [[#emojione-images][EmojiOne images]]
      • [[#twemoji-images][Twemoji images]]
      • [[#source-code][Source code]]

** What is this? Emojify is an Emacs extension to display emojis. It can display github style emojis like 😄 or plain ascii ones like :). It tries to be as efficient as possible, while also providing a lot of [[#customizations][flexibility]]

** What does it look like? Here is how the commit log of this project looks with emojify mode enabled

[[https://raw.githubusercontent.com/iqbalansari/emacs-emojify/master/screenshots/emojify-in-action.png][screenshots/emojify-in-action.png?raw=true]]

If you prefer a GIF you can view one [[https://raw.githubusercontent.com/iqbalansari/emacs-emojify/master/screenshots/emojify-in-action.gif][here]].

** Requirements This package requires Emacs v24.3 and above. Emacs should be compiled with support for PNG images to display emojis as images. It is recommended that Emacs is compiled with ImageMagick support. emojify will use it to resize emojis if needed, additionally imagemagick is used to set background color for emojis to workaround the bug described in [[https://github.com/iqbalansari/emacs-emojify/issues/7][issue 7]]. However these are completely optional.

PNG support might require some additional steps to on Windows, you might find [[http://stackoverflow.com/questions/2650041/emacs-under-windows-and-png-files][this]] stackoverflow answer helpful.

** Installation *** ELPA emojify is available on [[http://melpa.org/#/emojify][MELPA]] and [[http://stable.melpa.org/#/emojify][MELPA Stable]]. Please follow the instructions on MELPA [[http://melpa.org/#/getting-started][website]] to enable it, if you haven't already.

You can then install ~emojify~ from the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Menu.html][package menu]]. Alternatively install it by doing the following

Refresh the package index
#+BEGIN_QUOTE
M-x package-refresh-contents RET
#+END_QUOTE

And then install it by doing
#+BEGIN_QUOTE
M-x package-install RET emojify
#+END_QUOTE

**** With use-package #+begin_src elisp (use-package emojify :hook (after-init . global-emojify-mode)) #+end_src ** Usage *** Displaying emojis emojify-mode can be enabled/disabled separately for a buffer by using the command emojify-mode, to enable/disable it globally use the command global-emojify-mode.

To enable ~emojify-mode~ globally at startup add something like the
following to your ~init~ file

#+BEGIN_SRC emacs-lisp
  (add-hook 'after-init-hook #'global-emojify-mode)
#+END_SRC

Emojify integrates with packages like ~prettify-symbol-mode~ and
~org-bullets-mode~ which display text differently, if the alternate text
displayed by these packages match an emoji, ~emojify~ will display them too.
See [[#displaying-composed-text-as-emojis][Displaying composed text as emojis]] for more details. Emojify can also
display emojis in ~company-mode~ tooltips, see [[#displaying-emojis-in-company-mode-tooltips][Displaying emojis in company mode tooltips]]
for more details.

*[EXPERIMENTAL]* Emojify can be used for displaying emojis in the mode-line,
to enable/disable it for individual buffers use the command
~emojify-mode-line-mode~, to enable/disable it globally use the command
~global-emojify-mode-line-mode~.

*** Searching emojis The command emojify-apropos-emoji can be used to display emojis that match given regexp/apropos pattern. The results are displayed in a specialized buffer, where w or c can be used to copy emojis to the kill ring.

*** Inserting emojis The command emojify-insert-emoji can be used to insert emojis interactively. While the command works with vanilla Emacs completion system, the experience would be better with something like [[https://github.com/emacs-helm/helm][Helm]], [[https://github.com/abo-abo/swiper][Ivy]], [[https://www.emacswiki.org/emacs/Icicles][Icicles]] or Ido depending on you preference.

*** Describing emojis The command emojify-describe-emoji-at-point can be used to view explanation about the command displayed at point. Additionally the command emojify-describe-emoji can be used to display description for an arbitrary emoji.

*** Listing all emojis The command emojify-list-emojis can be used to view all the available emojis in a list form.

** Customizations *** Displaying composed text as emojis Emacs provides a way to modify how some parts of buffer are displayed using the composition text property. prettify-symbol-mode and org-bullets-mode are some popular packages that use this feature to display certain text in the buffer differently.

If the alternate display matches an emoji then ~emojify~ will display those
as emojis too. This is default behaviour. You can disable this behaviour by
setting ~emojify-composed-text-p~ to ~nil~.

*** Displaying emojis in company mode tooltips Emojify can also display emojis that are part of company-mode's completion tooltip (see [[https://github.com/dunn/company-emoji][company-emoji]] for an example of such tooltips). However this feature is turned off by default. To turn it on set emojify-company-tooltips-p to t.

*** Configuring the types of emojis displayed Emojify by default displays plain text emojis (:)), unicode emojis (😄) and github style emojis 😄. However this is customizable. You can do so by changing the value of emojify-emoji-styles using the customize interface. To change the value of the variable from Lisp using the function emojify-set-emoji-styles (or set it before loading emojify), call it with one parameter the list of styles that you want to be displayed. The possible styles are

- ascii            - Display only plain ascii emojis
- unicode          - Display only unicode emojis
- github           - Display only github style emojis

*** Configuring how emojis are displayed By default emojis are displayed using images. However you can instruct emojify to display it using unicode characters or ascii characters. To do so customize the variable emojify-display-style.

You can set it one of the following values
- image   - Display emojis using images, obviously this requires the Emacs
            instance to support image
- unicode - Display emojis using unicode characters, this might be a good
            option on platforms with good emoji fonts
- ascii   - This is simplest and does not require any external dependencies
            In this case emojify will display ascii equivalents of github
            style emojis.

*** Configuring the buffers where emojify mode is enabled You can control the buffers where emojify is enabled using emojify-inhibit-major-modes and emojify-inhibit-in-buffer-functions.

**** Major modes where emojify-mode should be not be enabled As the names suggests emojify-inhibit-major-modes is a list of major-modes where emojify should not be enabled.

**** Inhibiting emojify-mode using custom functions emojify-inhibit-in-buffer-functions is a list of functions that emojify calls before enabling emojify-mode in a buffer. If any of the functions return a non-nil value emojify-mode is not enabled in the buffer. Users can add custom functions to this list if they wish to inhibit emojify in certain buffers. The functions are called with one argument the buffer where emojify-mode is about to be enabled.

*** Configuring the texts that are displayed as emojis emojify offers two variables to inhibit the display of certain emojis.

**** Controlling the display of emojis in programming modes If enabled in programming modes emojify by default will display only emojis in string and comments. This behaviour can be customized using the variable emojify-prog-contexts. The variable can be set to one of the following values

 - comments - Display emojis only in comments
 - string   - Display emojis only in string
 - both     - Display emojis in comments as well as string
 - none     - Do not display emojis in programming modes

**** Inhibiting display of emojis using custom functions emojify-inhibit-functions is a list of function emojify calls before displaying certain text as emoji, if any of the functions return a non-nil value the corresponding text is not displayed as emoji. Users can add custom functions to this list, if they inhibit display of emojis in under certain conditions. The functions are called with three arguments

 - text - The text that is about to be displayed as an emoji
 - beg  - The beginning point of text in the buffer
 - end  - The ending point of text in the buffer

 These functions are called with the buffer where emoji is being displayed
 selected.

*** Customizing the behaviour when point enters an emoji The behaviour when point enters an emoji can be customized using the variable emojify-point-entered-behaviour. It can have one of the following values

- echo    - Display the emojified text in the minibuffer
- uncover - Temporarily display the underlying text while point is in the emojified text

Additionally it can be set to a custom function, the function is called with
two parameters (the buffer where the emoji appears is selected while running
the function)

- beg    - The beginning position of the text displayed as emoji
- end    - The ending position of the text displayed as emoji

The return value of the function is ignored.

*Note:* The custom function will be called for once for each character in an
emoji as point moves through them. Avoid manipulating the buffer in these
functions

*** Customizing the behaviour during isearch-mode By default in isearch-mode the underlying emoji is displayed temporarily when point enters the emoji while searching (similar to uncover behaviour mentioned [[#controlling-behaviour-when-point-enters-an-emoji][above]]). This can be disabled by setting emojify-reveal-on-isearch to nil.

*** Customizing the behaviour when mouse hovers over an emoji When mouse hovers over a emoji, the underlying text is displayed in a help popup. This behaviour can be disabled by setting emojify-show-help to nil.

*** Custom emojis You can specify custom emojis using the emojify-user-emojis variable. You need to set it to an alist where first element of cons is the text to be displayed as emoji, while the second element of the cons is an alist containing data about the emoji.

The inner alist should have atleast

1) "name"  - The name of the emoji
2) "style" - This should be one of "github", "ascii" or "github"

Additionally the alist should contain one of (see [[#configuring-the-types-of-emojis-displayed][emojify-display-style]])
1) "unicode" - The replacement for the provided emoji for "unicode" display style
2) "image"   - The replacement for the provided emoji for "image" display style.
               This should be the *absolute* path to the image
3) "ascii"   - The replacement for the provided emoji for "ascii" display style

It is best to set this variable before you load ~emojify~, in case you set
this variable after loading ~emojify~ run the function
~emojify-set-emoji-data~ to recalculate emoji data.

User emojis take precedence over default emojis so the above mechanism can
also be used to override the default emojis

**** Example Below is an example of setting up custom emojis. Assuming that the custom images are at ~/.emacs.d/emojis/trollface.png and ~/.emacs.d/emojis/neckbeard.png, you instruct emojify to display and as and

 #+BEGIN_SRC emacs-lisp
   (setq emojify-user-emojis '(("" . (("name" . "Troll Face")
                                                 ("image" . "~/.emacs.d/emojis/trollface.png")
                                                 ("style" . "github")))
                               ("" . (("name" . "Neckbeard")
                                                 ("image" . "~/.emacs.d/emojis/neckbeard.png")
                                                 ("style" . "github")))))

   ;; If emojify is already loaded refresh emoji data
   (when (featurep 'emojify)
     (emojify-set-emoji-data))
 #+END_SRC

** Known issues

  • Emojis are not properly updated after customizing emojify-display-style or emojify-program-contexts. For time being you will be fine as long as you set these variables before emojify has loaded.
  • Some of the emojis prompted in the commands like emojify-insert-emoji might not be displayed by emojify, this might happen if you have newer emoji data but old set of images. Download the latest emoji image using emojify-download-emoji and set emojify-emoji-set to the downloaded set.

** Contributing Code as well as documentation contributions are welcome.

[[https://github.com/cask/cask][Cask]] is used to manage project dependencies so make sure you have it installed. To run the tests you need to install the dependencies by running the following

#+BEGIN_SRC sh cask install #+END_SRC

After the installation completes you can run the tests by running the following command

#+BEGIN_SRC sh cask exec ert-runner #+END_SRC

** Thanks Special thanks to @ryanprior for bug reports and valuable feedback on the issue tracker.

** Credits Emoji set designed and offered free by [[http://emojione.com][Emoji One]].

** Licence *** EmojiOne images The emoji images are distributed under [[http://creativecommons.org/licenses/by-sa/4.0/][Creative Commons License]] (CC-BY-SA).

*** OpenMoji images All emojis designed by [[https://openmoji.org/][OpenMoji]] – the open-source emoji and icon project. License: [[https://creativecommons.org/licenses/by-sa/4.0/#][CC BY-SA 4.0]]

*** Twemoji images Copyright 2018 Twitter, Inc and other contributors Code licensed under the MIT License: http://opensource.org/licenses/MIT Graphics licensed under CC-BY 4.0: https://creativecommons.org/licenses/by/4.0/

*** Source code The source code is distributed under [[http://www.gnu.org/licenses/quick-guide-gplv3.html][GNU General Public License v3]]. See [[LICENSE][LICENSE]].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].