From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#56102: 29.0.50; fit-frame-to-buffer's window-text-pixel-size calculation can be incorrect when only is set to vertically Date: Mon, 27 Jun 2022 10:24:08 +0200 Message-ID: References: <834k0ckdet.fsf@gnu.org> <0807c810-af05-f92c-17ce-991056906629@gmx.at> <62155072-ac5f-2a3d-b1dd-0c9363c74975@gmx.at> <1a6138f1-fae9-4d33-28b4-7069028ccc36@gmx.at> 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="11269"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 56102@debbugs.gnu.org To: Aaron Jensen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 27 10:25:53 2022 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 1o5k49-0002oI-Ch for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Jun 2022 10:25:53 +0200 Original-Received: from localhost ([::1]:60668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5k47-0001XY-VF for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Jun 2022 04:25:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5k3M-0001Ob-0y for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 04:25:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5k3K-0008Mv-Ld for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 04:25:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o5k3K-0001o4-I1 for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 04:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Jun 2022 08:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56102 X-GNU-PR-Package: emacs Original-Received: via spool by 56102-submit@debbugs.gnu.org id=B56102.16563182626859 (code B ref 56102); Mon, 27 Jun 2022 08:25:02 +0000 Original-Received: (at 56102) by debbugs.gnu.org; 27 Jun 2022 08:24:22 +0000 Original-Received: from localhost ([127.0.0.1]:49762 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5k2f-0001mZ-Mk for submit@debbugs.gnu.org; Mon, 27 Jun 2022 04:24:21 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:35507) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5k2d-0001mJ-IV for 56102@debbugs.gnu.org; Mon, 27 Jun 2022 04:24:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1656318252; bh=pFpttb3qvI/lVcx+O60QU8aVhPKmOHUZCVmdvMnLtFI=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=YzhOb0ZnGWP+X8699GUjvQXzA3wox+UDEhmTRqX2ro2XG9KIz3FezwhBvveMjmA9Y l1pIZzyvE/n8wFFBg/kVKzazGv+Am+b39CdD7o1pgtxkfqtiZYjTjt+Oz06FGjbn6M iAyMVwm13DP3+wTzFJP07JNSoxVxVAJZIS2R02Yg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.102] ([213.142.96.80]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N0FxV-1nlD5P0YLv-00xJNj; Mon, 27 Jun 2022 10:24:12 +0200 Content-Language: en-US In-Reply-To: X-Provags-ID: V03:K1:onO2+3F/F3QqVcggvl7HQ6v20eyRIxR6xN2NMhf9BKUzSRmz5uE 0quf5+X0IThyyn/SKgRPp1OvQ0RSy4XfsxFfyY4+Wsq38iZTFkkVNYMbZe9SVuSPfIPF0xB FUHbwr2WKyATpkG3svd2uTbGR6l9Cws+lOSjUJqlj3zlAJEofGChl1AMIQRlyAPSa5gGptM RUUasmxoOD6w0pDaetU1Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:Opt/yZdYe5U=:4x7N/zqEXqOovjiiEB8AbH ZYW3YZz031NkXRsAV865cnjQw5h3GBcreX23ME86JM+Mo3q/mCRAdv30QGNA+5TGdytwYZ+AM Ck+2bncqthiJ4ilvNIZGqQSqQp9uUrY6LwKTBB54+qRfrYOoObp1/+xk9dZiNK8MER1yoktda gde8v6zw5Kq2FkM99fu6+aFwXGNchKfEskIIZXZVrOx2ie+v6bZfKvB1EKhFjcJvKO4r5v51r Bxhm686nLyGeQv6NlKyNqH55502fuw2OLQuHhlRg85cDVnVDClJrez8+pgx3e3f3Ojh9CTz6F +Wk68dkeJhM3cXig6/Buc2ofH43eH5VNn1xt4mH333yiI+9NAB5OLUPaW7FhEJZyn3WExbo5x 6nLfW1Q++5daZCTfqaosdH62FbisxYZmhEuSUw+sgEPwcG9WtZ1xDoXCeNlChebJnHuLoGdhk ouo3EAHseNAuCIxCoMzPFqtcK5xZbLxVvXni6bV6hqvaFwKRCbzjUx7ErXRoYInrh+mVAdVxA RaKiTUCinmHS/vSNa/adD8ZtVHjr6jGddKMJAcpl9zQTI00Lep3yhMdj41DEqFaYJUIxHpkMT 9wgeOQ/C6crOmU/EEvdzMc/nYJ2vSPqp/i8V8OcLBIGtKvFKgggv1DmrJe4efpVoCBQWOvEgW WE6AggxN0SwwQDRiLKb3mzlU/og+PBVQsH/ypnqygRpJi/qB7XlXfRE9YsZJI3Z4CE6eeMtKM WQ6MlnoaG5Qy3YlgT4ybpA1uDQ0WZo1SjMiqouWXJpvB10oGeTNOXC20WTzaZpymDebG1DS7 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" Xref: news.gmane.io gmane.emacs.bugs:235420 Archived-At: >> With a non-standard setup, say >> after doing >> >> (set-window-margins nil 10 10) >> >> in the root window, your fix will fail with the scenario you provided >> earlier. > > Ah, I can confirm this. Is there a reasonable way for me to calculate > a max-width that would be based on the root window that would work? Here (set-window-margins nil 10 10) (fit-frame-to-buffer nil nil nil (window-body-width) nil 'vertically) seems to work. > There's other math that happens within fit-frame-to-buffer I don't > fully have my head wrapped around yet. I'm not super worried about > this personally as I don't set window margins on this window. Similar problems should happen when the fringe or scroll bar sizes of the root window or its buffer differ from that of the frame. > The patch works for me and seems good. When you say if you come up > with a reasonable fix, could I ask what is unreasonable about the > patch you attached? The current code interprets all its -HEIGHT and -WIDTH arguments as if they were body sizes and not total sizes. This at least contradicts the doc-strings of 'fit-frame-to-buffer-sizes' and of 'fit-frame-to-buffer' itself. If I can fix the problem by rewriting the doc-strings to match what the code does, I'll probably do that. In general, you can't get these right anyway when you allow specifications in terms of character sizes and windows/frames may have non-integral sizes wrt these. > Regardless, if you do end up updating the fix to respect a supplied > max-width even if only vertically is supplied, I could always make an > Emacs version based decision on whether or not to pass the work-around > max-width in, and Emacs 29 is as good a version as any to stop passing > it in (people already on master will have to recompile, but that's > fine imo). So, I would be fine with the new patch going straight to > master, though as I mentioned I don't know what it would do > differently or why. I don't know yet either. I'll send you a patch as soon as I have one. martin