Subject: bug#59122: 29.0.50; global-text-scale-adjust not working

From: Gregory Heytings <[email-masked]>
Date: Thu, 10 Nov 2022 08:33:23 +0000

>
> So, I tried the patch (applied on top of 04ade0508d) and it does not fix 
> the problem.  After `M-x global-text-scale-adjust RET', the command 
> immediately makes the font larger (without me ever pressing `+'), and 
> `-' still does nothing.
>

Thanks.  Can you try the attached patch instead, and post what you see in 
*Messages*?

diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 432385587b..28ab3d2fb1 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -461,6 +461,8 @@ global-text-scale-adjust-limits
 
 (defvar global-text-scale-adjust--default-height nil)
 
+(defvar global-text-scale-adjust--increment-factor 5)
+
 ;;;###autoload (define-key ctl-x-map [(control meta ?+)] 'global-text-scale-adjust)
 ;;;###autoload (define-key ctl-x-map [(control meta ?=)] 'global-text-scale-adjust)
 ;;;###autoload (define-key ctl-x-map [(control meta ?-)] 'global-text-scale-adjust)
@@ -499,16 +501,26 @@ global-text-scale-adjust
            (cur (face-attribute 'default :height))
            (inc
             (pcase key
-              (?- (* (- increment) 5))
+              (?- (* (- increment)
+                     global-text-scale-adjust--increment-factor))
               (?0 (- global-text-scale-adjust--default-height cur))
-              (_ (* increment 5))))
+              (_ (* increment
+                    global-text-scale-adjust--increment-factor))))
            (new (+ cur inc)))
       (when (< (car global-text-scale-adjust-limits)
                new
                (cdr global-text-scale-adjust-limits))
         (let ((frame-inhibit-implied-resize
                (not global-text-scale-adjust-resizes-frames)))
-          (set-face-attribute 'default nil :height new)))
+          (message "global-text-scale-adjust %d -> %d" cur new)
+          (set-face-attribute 'default nil :height new)
+          (when (= cur (face-attribute 'default :height))
+            (setq global-text-scale-adjust--increment-factor
+                  (1+ global-text-scale-adjust--increment-factor))
+            (message "global-text-scale-adjust %d, trying again with %d"
+                     (face-attribute 'default :height)
+                     global-text-scale-adjust--increment-factor)
+            (global-text-scale-adjust increment))))
       (when (characterp key)
         (set-transient-map
          (let ((map (make-sparse-keymap)))