[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces
From: |
Robert Pluim |
Subject: |
bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces |
Date: |
Wed, 05 Apr 2023 11:12:31 +0200 |
>>>>> On Wed, 05 Apr 2023 11:45:35 +0300, Eli Zaretskii <eliz@gnu.org> said:
>> Thatʼs not a valid 'face property, unless Iʼm misreading (info
>> "(elisp) Special Properties"), plus the ':height 1.331' bit is wrong,
>> thatʼs (expt 1.1 3), not (expt 1.1 4). Yet it works, the height has
>> been increased.
Eli> The first "+" doesn't increase the height, though.
Hmm, youʼre right. Although if I then move to a different place in the
buffer, and do 'C-x 8 e +' it does increase the height first time. Is
this an interaction with font-lock?
Oh, and it doesnʼt work at eob. And increase followed by decrease
doesnʼt get you back to :height 1.0. And thereʼs no reset. I think
Iʼll only fix the first one on emacs-29 :-)
>> Is this a bug in our interpretation of 'face properties?
Eli> Face properties can be specified in many strange ways, and the fact
Eli> that some invalid specifications seem to "work" doesn't mean we have a
Eli> bug, it just means some invalid faces fall through the cracks.
OK. Iʼll make the code match the documented behaviour, and not worry
about it too much 😀
>> I can fix the code in `emoji-zoom-increase' to produce something like
>>
>> ((:height 1.4641000000000004) font-lock-comment-delimiter-face)
>>
>> instead
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:
diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index bcd4aac4f29..a9ed6e79cc9 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -708,22 +708,24 @@ 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))
+ (height (or (and (consp old)
+ (plist-get (car old) :height))
+ 1.0))
+ (inhibit-read-only t))
+ (with-silent-modifications
+ (if (consp old)
+ (add-text-properties
+ (point) (1+ (point))
+ (list 'face (cons (plist-put (car old) :height (* height factor))
+ (cdr old))
+ 'rear-nonsticky t))
+ (add-face-text-property (point) (1+ (point))
+ (list :height (* height factor)))
+ (put-text-property (point) (1+ (point))
+ 'rear-nonsticky t))))))
;;;###autoload
(defun emoji-zoom-decrease ()
Robert
--
- bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces, Robert Pluim, 2023/04/05
- bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces, Eli Zaretskii, 2023/04/05
- bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces,
Robert Pluim <=
- bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces, Eli Zaretskii, 2023/04/05
- bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces, Robert Pluim, 2023/04/05
- bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces, Eli Zaretskii, 2023/04/05
- bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces, Robert Pluim, 2023/04/05
- bug#62675: 29.0.60; emoji-zoom-increase interacts badly with faces, Robert Pluim, 2023/04/06