GNU bug report logs - #62675
29.0.60; emoji-zoom-increase interacts badly with faces

Previous Next

Package: emacs;

Reported by: Robert Pluim <rpluim <at> gmail.com>

Date: Wed, 5 Apr 2023 07:39:01 UTC

Severity: normal

Tags: fixed

Found in version 29.0.60

Fixed in version 29.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 62675 <at> debbugs.gnu.org
Subject: bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces
Date: Wed, 05 Apr 2023 13:55:22 +0200
>>>>> On Wed, 05 Apr 2023 12:54:27 +0300, Eli Zaretskii <eliz <at> gnu.org> said:

    >> From: Robert Pluim <rpluim <at> gmail.com>
    >> Cc: 62675 <at> debbugs.gnu.org
    >> Date: Wed, 05 Apr 2023 11:12:31 +0200
    >> 
    Eli> Please do, and thanks.  We don't need to understand why some bug seems
    Eli> to work, it is enough to fix the bug.
    >> 
    >> This seems to work:

    Eli> Looks reasonable, thanks.  Please try both with font-lock-mode ON and
    Eli> OFF, and in the latter case both with some non-default face at point
    Eli> and without.

Ah yes, font-lock off makes it all more complex. Tested in those 3
cases. Is this too much for emacs-29?

diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index bcd4aac4f29..ff55170875e 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -708,22 +708,32 @@ emoji-zoom-increase
 FACTOR is the multiplication factor for the size."
   (interactive)
   (set-transient-map emoji-zoom-map t nil "Zoom with %k")
-  (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)))))
+  (unless (eobp)
+    (let* ((factor (or factor 1.1))
+           (old (get-text-property (point) 'face))
+           ;; The text property is either a named face, or a plist
+           ;; with :height, or a list starting with such a plist,
+           ;; followed by one or more faces.
+           (newheight (* (or (and (consp old)
+                                  (or (plist-get (car old) :height)
+                                      (plist-get old :height)))
+                             1.0)
+                         factor))
+           (inhibit-read-only t))
+      (with-silent-modifications
+        (if (consp old)
+            (add-text-properties
+             (point) (1+ (point))
+             (list 'face
+                   (if (eq (car old) :height)
+                       (plist-put old :height newheight)
+                     (cons (plist-put (car old) :height newheight)
+                           (cdr old)))
+                   'rear-nonsticky t))
+          (add-face-text-property (point) (1+ (point))
+                                  (list :height newheight))
+          (put-text-property (point) (1+ (point))
+                             'rear-nonsticky t))))))
 
 ;;;###autoload
 (defun emoji-zoom-decrease ()

Robert
-- 




This bug report was last modified 2 years and 46 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.