Compose Emoji in GNU Emacs
Modern emojis are composable - you can compose multiple emojis into a new one. Most commonly, this is done using Zero-Width Joiner or ZWJ character (#200D). Though not all combinations are valid. The valid combinations are defined by the font. e.g. you can combine as follows:
- Person + rocket = Astronaut
- Person + manual wheelchair = Person on wheelchair
Following function will help you insert ZWJ in between selected text.
(defun emoji-compose ()
"Compose emoji from components."
(interactive)
(unless (region-active-p)
(error "Select a sequence of emoji components"))
(let* ((start (1+ (region-beginning)))
(len (- (region-end) start)))
(goto-char start)
(dotimes (i len)
(insert #x200D)
(forward-char))))
"Compose emoji from components."
(interactive)
(unless (region-active-p)
(error "Select a sequence of emoji components"))
(let* ((start (1+ (region-beginning)))
(len (- (region-end) start)))
(goto-char start)
(dotimes (i len)
(insert #x200D)
(forward-char))))
For auto-completion, you can use company-emoji.
References
Comments
Post a Comment