unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gregory Heytings <gregory@heytings.org>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: "Rudolf Adamkovič" <salutis@me.com>, 59122@debbugs.gnu.org
Subject: bug#59122: 29.0.50; global-text-scale-adjust not working
Date: Thu, 10 Nov 2022 17:00:50 +0000	[thread overview]
Message-ID: <b415ac7a1040addca3b3@heytings.org> (raw)
In-Reply-To: <CADwFkmkkAE5dmyWvg9SgLusmOmZvb34mVmY55iXy=98AEeF0pQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]


>
> Here's the result of 'M-x global-text-scale-adjust RET' and then typing 
> '-' repeatedly (in emacs -Q):
>

Thanks.  A call to redisplay was missing in the previous patch; the 
attached one should work.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix-global-face-scaling-bug-due-to-rounding.patch --]
[-- Type: text/x-diff; name=Fix-global-face-scaling-bug-due-to-rounding.patch, Size: 2380 bytes --]

From fa0825822c3ef344a3c18d3466fc4ac1820f91f6 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Thu, 10 Nov 2022 16:58:06 +0000
Subject: [PATCH] Fix global face scaling bug due to rounding.

* lisp/face-remap.el (global-text-scale-adjust): Try again if the face
height did not actually change.
(global-text-scale-adjust--increment-factor): New internal variable.
Fixes bug#59122.
---
 lisp/face-remap.el | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 432385587b..3c14085a63 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,23 @@ 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)))
+          (set-face-attribute 'default nil :height new)
+          (redisplay 'force)
+          (when (= cur (face-attribute 'default :height))
+            (setq global-text-scale-adjust--increment-factor
+                  (1+ global-text-scale-adjust--increment-factor))
+            (global-text-scale-adjust increment))))
       (when (characterp key)
         (set-transient-map
          (let ((map (make-sparse-keymap)))
-- 
2.35.1


  reply	other threads:[~2022-11-10 17:00 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 12:28 bug#59122: 29.0.50; global-text-scale-adjust not working Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-08 12:42 ` Eli Zaretskii
2022-11-08 12:47 ` Gregory Heytings
2022-11-08 21:48   ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-09  3:33     ` Eli Zaretskii
2022-11-09 10:00     ` Gregory Heytings
2022-11-09 13:28       ` Stefan Kangas
2022-11-09 13:39         ` Gregory Heytings
2022-11-09 14:30           ` Stefan Kangas
2022-11-09 14:36             ` Robert Pluim
2022-11-09 14:43               ` Stefan Kangas
2022-11-09 14:48                 ` Robert Pluim
2022-11-09 14:47               ` Gregory Heytings
2022-11-09 14:59                 ` Stefan Kangas
2022-11-09 15:20                   ` Robert Pluim
2022-11-09 14:36             ` Gregory Heytings
2022-11-09 14:51               ` Eli Zaretskii
2022-11-09 14:59                 ` Eli Zaretskii
2022-11-09 15:25                   ` Robert Pluim
2022-11-09 16:02                   ` Gregory Heytings
2022-11-09 16:55                     ` Eli Zaretskii
2022-11-10  0:44                       ` Stefan Kangas
2022-11-10  7:56                         ` Eli Zaretskii
2022-11-09 16:01                 ` Gregory Heytings
2022-11-09 16:53                   ` Eli Zaretskii
2022-11-09 16:18             ` Gregory Heytings
2022-11-10  0:26               ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-10  8:33                 ` Gregory Heytings
2022-11-10 16:16                   ` Stefan Kangas
2022-11-10 17:00                     ` Gregory Heytings [this message]
2022-11-11 16:05                       ` Stefan Kangas
2022-11-13  0:23                         ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-13  3:05                           ` Stefan Kangas
2022-11-13  6:59                             ` Eli Zaretskii
2022-11-13 13:06                               ` Stefan Kangas
2022-11-13  9:18                             ` Gregory Heytings
2022-11-13 13:48                               ` Stefan Kangas
2022-11-13 16:33                                 ` Eli Zaretskii
2022-11-13 19:39                                   ` Gregory Heytings
2022-11-13 20:09                                     ` Eli Zaretskii
2022-11-19 15:52                                   ` Gregory Heytings
2022-11-13  6:57                           ` Eli Zaretskii
2022-11-13  9:10                             ` Gregory Heytings
2022-11-13 22:37                             ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-14  0:00                               ` Stephen Berman
2022-11-14  3:31                               ` Eli Zaretskii
2022-11-09 13:40         ` Eli Zaretskii
2022-11-09 14:35           ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b415ac7a1040addca3b3@heytings.org \
    --to=gregory@heytings.org \
    --cc=59122@debbugs.gnu.org \
    --cc=salutis@me.com \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).