commit d5397f3db8df7a21f9c70868ca16b67155d896ce
parent 46c9b7f79d35baa02ad56544b3fd8076882e3fd9
Author: Iqbal Ansari <iqbalansari02@yahoo.com>
Date: Sun, 18 Sep 2016 00:14:08 +0530
Display composed text as emojis only if user has enabled unicode emojis
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/emojify.el b/emojify.el
@@ -444,7 +444,7 @@ This returns non-nil if the region is valid according to `emojify-program-contex
(t 'code))))
(and (memql context emojify-program-contexts)
(if (equal context 'code)
- ;; If context is code display only unicode emojis
+ ;; Display only unicode or prettify-symbol emojis in code context
(or (and (string= (ht-get emoji "style") "unicode")
(memql 'unicode emojify-emoji-styles))
(and (string= (ht-get emoji "style") "prettify-symbol")
@@ -1027,7 +1027,10 @@ should not be a problem 🤞."
(sit-for 0 t)))
;; Loop to emojify composed text
- (when emojify-composed-text-p
+ (when (and emojify-composed-text-p
+ ;; Skip this if user has disabled unicode style emojis, since
+ ;; we display only composed text that are unicode emojis
+ (memql 'unicode emojify-emoji-styles))
(goto-char beg)
(let ((compose-start (if (get-text-property beg 'composition)
;; Check `beg' first for composition property
@@ -1045,7 +1048,8 @@ should not be a problem 🤞."
(emoji (emojify-get-emoji match))
(compose-end (next-single-property-change compose-start 'composition)))
;; Display only composed text that is unicode char
- (when (and emoji (string= (gethash "style" emoji) "unicode"))
+ (when (and emoji
+ (string= (gethash "style" emoji) "unicode"))
(emojify--display-emoji emoji match (current-buffer) compose-start compose-end))
;; Setup the next loop
(setq compose-start (and compose-end (next-single-property-change compose-end