From: Eli Zaretskii <eliz@gnu.org>
To: Emre Yolcu <mail@emreyolcu.com>
Cc: 71085@debbugs.gnu.org
Subject: bug#71085: text-scale-adjust does not adjust margin width
Date: Tue, 21 May 2024 14:38:19 +0300 [thread overview]
Message-ID: <86r0dv8kes.fsf@gnu.org> (raw)
In-Reply-To: <C7031EF2-EBCF-42B6-A79E-B1EA6B4F37FD@emreyolcu.com> (message from Emre Yolcu on Mon, 20 May 2024 18:50:28 -0400)
tags 71085 notabug
thanks
> From: Emre Yolcu <mail@emreyolcu.com>
> Date: Mon, 20 May 2024 18:50:28 -0400
>
> As of Emacs 29.3, changing the text size in a buffer using
> text-scale-adjust has no affect on margin width. Since the text displayed
> in the margins has the same height as the text in the buffer, this
> behavior causes the text in the margin to be clipped if we increase the
> text size too much by using text-scale-adjust. Here are the steps to
> confirm:
>
> 1. Launch with "emacs -Q".
> 2. Evaluate:
>
> (set-window-fringes nil 0)
> (set-window-margins nil 1)
>
> 3. Switch to a scratch buffer.
> 4. Place the cursor, which should be box-shaped by default, on the
> first-column of the buffer.
> 5. Increase the text size in the buffer by pressing C-x C-= several times.
>
> Expected behavior: Left margin has exactly the same width as that of the cursor.
> Current behavior: Left margin has width much smaller than that of the cursor.
I don't understand the expectations: the window and frame geometry are
not changed by text-scale-adjust, so why did you expect the window
margins to change? The margins are part of the window geometry.
Since Emacs 29.1, we have global-text-scale-adjust-resizes-frames,
which, if non-nil, causes the frame to resize when you change the
text-size globally (e.g., with C-M-+ or C-M-mouse-wheel). If you do
that, the window-margins resize as well, which in this case is indeed
expected (and works for me).
> It also seems to me that there is no way to work around this problem in
> the Elisp layer, because text-scale-mode works by remapping faces in a
> buffer-local manner; however,
> - there is no face defined for the margins, and
> - it seems that the pixel width of the margins is not determined in a
> buffer-local manner.
>
> Given that {left,right}-margin-width are buffer-local variables, I would
> expect their pixel width to be determined in a buffer-local manner.
The above is inaccurate: the text shown in the margin can have its own
distinct face. For example, try this in "emacs -Q":
M-x font-lock-mode RET
M-<
M-: (set-window-margins nil 4 4) RET
M-: (add-text-properties (point) (1+ (point)) (list 'display (list '(margin left-margin) (propertize "FOO" 'face 'warning)))) RET
You will see the string "FOO" displayed in the margin with a distinct
face. You could define this face to have an absolute :height
attribute, in which case the text in the margin will not scale, and
thus will not be clipped when you use text-size-adjust. So there _is_
in fact a way to work around, even if you don't want to use
global-text-scale-adjust-resizes-frames and the globalized
text-scaling.
I see no bug here.
next prev parent reply other threads:[~2024-05-21 11:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-20 22:50 bug#71085: text-scale-adjust does not adjust margin width Emre Yolcu
2024-05-21 11:38 ` Eli Zaretskii [this message]
2024-05-21 16:14 ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-21 16:14 ` Emre Yolcu
2024-05-21 18:17 ` Eli Zaretskii
2024-05-21 20:10 ` Emre Yolcu
2024-05-22 12:03 ` Eli Zaretskii
2024-05-22 17:05 ` Emre Yolcu
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86r0dv8kes.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=71085@debbugs.gnu.org \
--cc=mail@emreyolcu.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.