Add new commands to zoom emojis

* lisp/international/emoji.el (emoji-zoom-map)
(emoji-zoom-increase, emoji-zoom-decrease): New commands.

* lisp/international/mule-cmds.el (ctl-x-map): Bind them.
This commit is contained in:
Lars Ingebrigtsen 2022-06-30 10:46:59 +02:00
parent ebd980bc7e
commit 371c4f642a
3 changed files with 48 additions and 1 deletions

View file

@ -607,6 +607,11 @@ inserted.
This command will tell you the name of the Emoji at point. (This
command also works for non-Emoji characters.)
---
*** New commands 'emoji-zoom-increase' and 'emoji-zoom-decrease'.
These are bound to 'C-x 8 e +' and 'C-x 8 e -', respectively. They
can be used on any character, but are mainly useful for emoji.
---
*** New input method 'emoji'.
This allows you to enter emoji using short strings, eg ':face_palm:'

View file

@ -700,6 +700,46 @@ We prefer the earliest unique letter."
(emoji--define-transient
(cons "Choose Emoji" (cons glyph derived))))))))))
(defvar-keymap emoji-zoom-map
"+" #'emoji-zoom-increase
"-" #'emoji-zoom-decrease)
;;;###autoload
(defun emoji-zoom-increase (&optional factor)
"Increase the size of the character under point.
FACTOR is the multiplication factor for the size.
This command will be repeatable if `repeat-mode' is switched on."
(interactive)
(let* ((factor (or factor 1.1))
(old (get-text-property (point) 'face))
(height (or (and (consp old)
(plist-get old :height))
1.0))
(inhibit-read-only t))
(with-silent-modifications
(if (consp old)
(add-text-properties
(point) (1+ (point))
(list 'face (plist-put (copy-sequence old) :height (* height factor))
'rear-nonsticky t))
(add-face-text-property (point) (1+ (point))
(list :height (* height factor)))
(put-text-property (point) (1+ (point))
'rear-nonsticky t)))))
(put 'emoji-zoom-increase 'repeat-map 'emoji-zoom-map)
;;;###autoload
(defun emoji-zoom-decrease ()
"Decrease the size of the character under point.
This command will be repeatable if `repeat-mode' is switched on."
(interactive)
(emoji-zoom-increase 0.9))
(put 'emoji-zoom-decrease 'repeat-map 'emoji-zoom-map)
(provide 'emoji)
;;; emoji.el ends here

View file

@ -3257,7 +3257,9 @@ as names, not numbers."
"s" #'emoji-search
"d" #'emoji-describe
"r" #'emoji-recent
"l" #'emoji-list))
"l" #'emoji-list
"+" #'emoji-zoom-increase
"-" #'emoji-zoom-decrease))
(defface confusingly-reordered
'((((supports :underline (:style wave)))