Open tecosaur opened 4 years ago
I have tried making such a minor mode, but it's somewhat buggy
(defun emojify--replace-text-with-emoji (orig-fn emoji text buffer start end &optional target)
"Modify `emojify--propertize-text-for-emoji' to replace ascii/github emoticons with unicode emojis, on the fly."
(if (or (not emoticon-to-emoji) (= 1 (length text)))
(funcall orig-fn emoji text buffer start end target)
(delete-region start end)
(insert (ht-get emoji "unicode"))))
(define-minor-mode emoticon-to-emoji
"Write ascii/gh emojis, and have them converted to unicode live."
:global nil
:init-value nil
(if emoticon-to-emoji
(progn
(setq-local emojify-emoji-styles '(ascii github unicode))
(advice-add 'emojify--propertize-text-for-emoji :around #'emojify--replace-text-with-emoji)
(unless emojify-mode
(emojify-turn-on-emojify-mode)))
(setq-local emojify-emoji-styles (default-value 'emojify-emoji-styles))
(advice-remove 'emojify--propertize-text-for-emoji #'emojify--replace-text-with-emoji)))
Hello!
I find this package great for viewing emoji in emacs, thre's just one related bit of functionality I'd love to see. For documents like emails I type in Emacs, I'd love it if my ascii emoji could be converted to unicode emoji in the buffer. This package already does a brilliant job recognising ascii emoji and displaying them as images, so I'm hoping it wouldn't be too much work to add a minor mode which converts ascii emoji to unicode on-type, or a function that I can use as a hook that perfoms such replacements over the buffer (IMO the first option would be preferable).
Thanks for all the work so far :grinning: