From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emre Yolcu Newsgroups: gmane.emacs.bugs Subject: bug#71085: text-scale-adjust does not adjust margin width Date: Tue, 21 May 2024 12:14:41 -0400 Message-ID: References: <86r0dv8kes.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5814"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 71085@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 21 18:16:12 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s9S9r-0001Cx-UQ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 May 2024 18:16:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9S9g-0002HG-8T; Tue, 21 May 2024 12:16:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9S9e-0002GX-Dy for bug-gnu-emacs@gnu.org; Tue, 21 May 2024 12:15:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s9S9e-0004cz-5i for bug-gnu-emacs@gnu.org; Tue, 21 May 2024 12:15:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s9S9j-0000Tk-DD for bug-gnu-emacs@gnu.org; Tue, 21 May 2024 12:16:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Emre Yolcu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 May 2024 16:16:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71085 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 71085-submit@debbugs.gnu.org id=B71085.17163081051806 (code B ref 71085); Tue, 21 May 2024 16:16:03 +0000 Original-Received: (at 71085) by debbugs.gnu.org; 21 May 2024 16:15:05 +0000 Original-Received: from localhost ([127.0.0.1]:49883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9S8m-0000T3-HY for submit@debbugs.gnu.org; Tue, 21 May 2024 12:15:04 -0400 Original-Received: from fout3-smtp.messagingengine.com ([103.168.172.146]:52645) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9S8e-0000RP-8P for 71085@debbugs.gnu.org; Tue, 21 May 2024 12:14:57 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfout.nyi.internal (Postfix) with ESMTP id A19F41381537; Tue, 21 May 2024 12:14:44 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 21 May 2024 12:14:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emreyolcu.com; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1716308084; x=1716394484; bh=EPYRVJAt1ufn00HJ1lxIS1jL15PUiHWm /bp2gymitOE=; b=3q4jc4i5UAhdZvxsvINZ1oF+fYeJQvgkZvArQBCydFOQIqew G+Grmr9LGbooqBar1S83Xe33j9pZfnQBtLn6kHfbIO2EWKps2S31t3bArGk7Burv cOhbl65MRTlkQj8itGhV4C2j6+gex6/9Nb3HrswIybcVim3Q13sdKMM5auX5H7Ur YRgLC+0Bk4C0qCzhpm8tQ88t5TbH0jzjY27NM1kLDmDt4n2EPF8aR0Jz4lXkWGQ9 1xjQ60dsix/az3DN64dRV98CJJtGK7rgD8a95VmjfaEaN+HTn1TwMqicxSPZeCOk nqx/H3Pac45NYZd30ZMqx3z5tPR8U3EKHJgQoA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1716308084; x= 1716394484; bh=EPYRVJAt1ufn00HJ1lxIS1jL15PUiHWm/bp2gymitOE=; b=T qcRI6eotkBM5HRB5p8G2liWa/M3WHXlayHRQ7iCADUUe8XQRYQH2LU2F7e1y014o F/VI24bDyQY4G4DF296I4C3kg5BiIzHy8VsNbSZR8BmFIqnJfKa3JyRNWoKaX04S jq8rsjIR9sRIcMpe8bR2Gt5oL/+h6diDN0EMP1PZM6ZrY8yWM3xp625gEUFlYx2Q mbVdn+VWtNnti+uu98Tc/kYl0tgYTh1RR2hGHzp1OF6riyts7Sdwf4T3uteLWrhc RJAbhPvM9kuOQ1GnIkfja78bu8UymgJ592Bg/OjEO+sN7PVxvDeFgmgysCFUcYI6 vQAPPhSQwZxWq3NV6MgfQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeivddgleeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpefgmhhr vgcujgholhgtuhcuoehmrghilhesvghmrhgvhiholhgtuhdrtghomheqnecuggftrfgrth htvghrnhepveeftdeiteevjeehvddvhfdtfeegfedtkedvheetjedugfffveehvdduueek tdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmh grihhlsegvmhhrvgihohhltghurdgtohhm X-ME-Proxy: Feedback-ID: i1b09467c:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 May 2024 12:14:44 -0400 (EDT) Content-Language: en-US In-Reply-To: <86r0dv8kes.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285542 Archived-At: Eli Zaretskii wrote: > 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. I was not thinking of the margins as part of the window geometry but as a special part of the buffer that we set aside and do not interact with. This is partly because the margins display text, the height of which is affected by text-scale-adjust, and partly because there is no visual separation between the margin and the buffer (assuming fringes are disabled). For comparison, the mode line also displays text, but it has its own face and its text size is not affected by text-scale-adjust (as one would expect). The fringe also has its own face, as do all of the other things that I would consider to be part of the window geometry, but there is no "margin" face. (I am aware that we can affect its display to some degree by propertizing the text in it.) > 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). Thanks for that suggestion. Indeed, I often change text size globally, but sometimes resizing in a buffer-local manner is nice to have. >> 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 didn't mean to imply that we cannot affect the appearance of the text displayed in the margins in any way, but simply that there is no "margin" face that a user can modify via, for instance, custom-set-faces. The workaround that you suggested requires the user to patch every single package that displays text in the margins, which is less than ideal. A much nicer workaround would be possible if there existed a "margin" face: text-scale-mode could simply remap it as it does the default face. As a motivating example, let me point out that text-scale-mode defines the variable text-scale-remap-header-line to allow resizing the size of the header line along with buffer text. If a "margin" face existed, we could add a new variable text-scale-remap-margin to achieve the behavior I suggested in an easy way. > I see no bug here. Fair enough. Please consider it a feature request for a "margin" face (for the reasons in the above paragraph). This is admittedly a highly niche problem, so I would understand if you think it is not worth the time. However, if you at least agree that having a face for the margins would be a welcome addition, I could make an attempt at a patch.