Add emoji-zoom-reset

* lisp/international/emoji.el (emoji-zoom-map): Add emoji-zoom-reset.
(emoji-zoom-reset): New function, it resets the zoom level.
* lisp/international/mule-cmds.el (ctl-x-map): Add emoji-zoom-reset.
* etc/NEWS: Announce new command.
This commit is contained in:
Robert Pluim 2023-04-05 17:24:38 +02:00
parent 470d269ec1
commit 305246d972
3 changed files with 22 additions and 2 deletions

View file

@ -1021,6 +1021,11 @@ works for non-Emoji characters.)
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 command 'emoji-zoom-reset'.
This is bound to 'C-x 8 e 0', and undoes any size changes performed by
'emoji-zoom-increase' and 'emoji-zoom-decrease'.
---
*** New input method 'emoji'.
This allows you to enter Emoji using short strings, eg ':face_palm:'

View file

@ -700,7 +700,8 @@ We prefer the earliest unique letter."
(defvar-keymap emoji-zoom-map
"+" #'emoji-zoom-increase
"-" #'emoji-zoom-decrease)
"-" #'emoji-zoom-decrease
"0" #'emoji-zoom-reset)
;;;###autoload
(defun emoji-zoom-increase (&optional factor)
@ -741,6 +742,19 @@ FACTOR is the multiplication factor for the size."
(interactive)
(emoji-zoom-increase 0.9))
;;;###autoload
(defun emoji-zoom-reset ()
"Reset the size of the character under point."
(interactive)
(with-silent-modifications
(let ((old (get-text-property (point) 'face)))
(when (and (consp old)
(remove-text-properties (point) (1+ (point)) '(rear-nonsticky nil)))
(if (eq (car old) :height)
(remove-text-properties (point) (1+ (point)) '(face nil))
(add-text-properties (point) (1+ (point)) (list 'face
(cdr old))))))))
(provide 'emoji)
;;; emoji.el ends here

View file

@ -3269,7 +3269,8 @@ single characters to be treated as standing for themselves."
"r" #'emoji-recent
"l" #'emoji-list
"+" #'emoji-zoom-increase
"-" #'emoji-zoom-decrease))
"-" #'emoji-zoom-decrease
"0" #'emoji-zoom-reset))
(defface confusingly-reordered
'((((supports :underline (:style wave)))