aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Pluim2023-04-05 15:19:13 +0200
committerRobert Pluim2023-04-06 13:36:11 +0200
commit470d269ec1fe58935ff1b13e04d030ec40dcaa5e (patch)
tree0663829adf06f6aee0ba998ad7944c8dc57742f9
parent63d4a86f8d1547593c49e8bf493757137eb147e0 (diff)
downloademacs-470d269ec1fe58935ff1b13e04d030ec40dcaa5e.tar.gz
emacs-470d269ec1fe58935ff1b13e04d030ec40dcaa5e.zip
Make emoji-zoom-{increase,decrease} set text properties correctly
* lisp/international/emoji.el (emoji-zoom-increase): Ensure that we're increasing the :height of the anonymous face at point, rather than having two :height properties, which appeared to work by accident, and don't error at eob. (Bug#62675)
-rw-r--r--lisp/international/emoji.el44
1 files changed, 27 insertions, 17 deletions
diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index bcd4aac4f29..ffff2aa1236 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -707,23 +707,33 @@ We prefer the earliest unique letter."
707 "Increase the size of the character under point. 707 "Increase the size of the character under point.
708FACTOR is the multiplication factor for the size." 708FACTOR is the multiplication factor for the size."
709 (interactive) 709 (interactive)
710 (set-transient-map emoji-zoom-map t nil "Zoom with %k") 710 (set-transient-map emoji-zoom-map t #'redisplay "Zoom with %k")
711 (let* ((factor (or factor 1.1)) 711 (unless (eobp)
712 (old (get-text-property (point) 'face)) 712 (let* ((factor (or factor 1.1))
713 (height (or (and (consp old) 713 (old (get-text-property (point) 'face))
714 (plist-get old :height)) 714 ;; The text property is either a named face, or a plist
715 1.0)) 715 ;; with :height, or a list starting with such a plist,
716 (inhibit-read-only t)) 716 ;; followed by one or more faces.
717 (with-silent-modifications 717 (newheight (* (or (and (consp old)
718 (if (consp old) 718 (or (plist-get (car old) :height)
719 (add-text-properties 719 (plist-get old :height)))
720 (point) (1+ (point)) 720 1.0)
721 (list 'face (plist-put (copy-sequence old) :height (* height factor)) 721 factor))
722 'rear-nonsticky t)) 722 (inhibit-read-only t))
723 (add-face-text-property (point) (1+ (point)) 723 (with-silent-modifications
724 (list :height (* height factor))) 724 (if (consp old)
725 (put-text-property (point) (1+ (point)) 725 (add-text-properties
726 'rear-nonsticky t))))) 726 (point) (1+ (point))
727 (list 'face
728 (if (eq (car old) :height)
729 (plist-put (copy-sequence old) :height newheight)
730 (cons (plist-put (car old) :height newheight)
731 (cdr old)))
732 'rear-nonsticky t))
733 (add-face-text-property (point) (1+ (point))
734 (list :height newheight))
735 (put-text-property (point) (1+ (point))
736 'rear-nonsticky t))))))
727 737
728;;;###autoload 738;;;###autoload
729(defun emoji-zoom-decrease () 739(defun emoji-zoom-decrease ()