From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Patch for fit-window-to-buffer Date: Wed, 4 Mar 2020 18:31:14 +0100 Message-ID: <1ff48e60-d78a-6e44-28e0-3aff795984b9@gmx.at> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="123034"; mail-complaints-to="usenet@ciao.gmane.io" To: Justin Burkett , emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 04 18:39:34 2020 Return-path: Envelope-to: ged-emacs-devel@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 1j9XzZ-000VtM-7A for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Mar 2020 18:39:33 +0100 Original-Received: from localhost ([::1]:37524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9XzY-0008DD-1h for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Mar 2020 12:39:32 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44641) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9Xra-0004bG-Ru for emacs-devel@gnu.org; Wed, 04 Mar 2020 12:31:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9Xra-0001Zs-07 for emacs-devel@gnu.org; Wed, 04 Mar 2020 12:31:18 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:43227) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j9XrZ-0001Za-Nr for emacs-devel@gnu.org; Wed, 04 Mar 2020 12:31:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1583343075; bh=2n9hY/bhpNd2gPmczwdF7KHVXnHmtoNO3CMl0GOasVA=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=TbydhKc5g63Ig6aNdClaW5og3PDrsjFsA6aAlk0oau4flsA41dGXcy6Wk/w0bYgzk a0cjkrwyoYNA1VLXKMuBbR/cqBiKwXU3K2fgOFSx8XNzay3BvUY2JbSstN0C1t2f81 IbKh8N8gADgUMoxES+4m4ryCY/kb+him6NwckpEg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.101] ([212.95.5.38]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MLQxN-1ir3NA3NGV-00IXOh; Wed, 04 Mar 2020 18:31:15 +0100 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K1:EkqessTeXwEOB9sPa+VeNCBrUkjG5Vf80bJ3t3TPbVplwMkO/Ix L6d9KglBB1OM8k478uoXt02FgoASNtztLG94NVaOt8PD+5XDZ5UKF6xBFoIRwjzpzjUDMM8 df2qqeOIzvhRTwcAjb+3hm71G5Rt74IHxcy6cZFIBX3puoFNwMoQUGdaQhDIopUvFZh9Vjj 4V896q+X0Pc0vCarUIUPQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:hxk/Siwy+SQ=:FsAR7g83R31/K1kE4FULEM gRBAF1/zFI53XJwvTVAqAObV5kD0W7bC0GMDivTJ8O4tr6C73YGuaXGO0HAGHp22BhgL5VXbD t0I5wKh40xqUO5Lvccl4gyNubEePAJY6YERwHlQq30tf06kZ1ejYhmqYUJhrbiCUHoPgdDFQv doT/xPOugwMphKaNuGUB3acQBNarkToPebMKRks0FfG9y4Bcck0BL2Z/eHMu1e/LhunY6a1mO c4LWFScC/utm2bQln3GRxfvnEYiTNkHXacPDHD+aB0MQlcJc5aEWTEnX9CJ1WmuEz+Ep/gZuu xa74MCU4leKEv1PgIMpIdDwelf0rYdHZ6DnOWxASuBdkgiPYjGiZiXXELDovm4NQNBX+tb3bT cjsxPLrIe8p1+0TN0ymayFY0gCRigfm8n9Uy8IWACKxTw5CNvTYN/FIj2CITwX7y+rIbFeBFr yXaXsnIjjJf+yWkwgDy+2QnQiGxCVLtHgqt0fqHvJQlbRk1nOsr7BBYD8B1CpMNK9KJUTIo3n xWiagscc2YkkG/D3Sn3TY1iM2JMY5GlHduJQ3hYohx4+m7MhW5oZA+vbAtYbz6YYpchoCuz71 lLHXsA/9KUUbZA2jhICjbrKK6YVSm3ubCNOLl1EK5gK58WsPkgkdA6snabqo8bqALHg9Y17yW VhFTwPPrAqY+X4xbvS6TafJ9RZQuAFXFJgn+mDPTtlnv795SLPBBwsf/+BPt3fHAK9X/tpUAD mevqU1eysP4fnaxQ6LdGiewTQSFcxDlfoNpLqPD2JoZBuCtBNVTMj7F24r/aWcI/AyxBMPFc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.18 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245231 Archived-At: > I found a bug in the master and emacs-27 versions of fit-window-to-buffer. > Another window's data might be used to determine the new width. I'm > attaching a patch which I believe fixes the issue. Thanks for finding these blatant bugs. The 'window-start' fix is OK. The 'point-max' fix could be improved: Since 'window-text-pixel-size' has to make the buffer shown in WINDOW current before processing its text anyway, it would IMO be more efficient to wrap the entire 'window-text-pixel-size' call into a (with-current-buffer (window-buffer window) form and thus avoid selecting WINDOW while providing the right buffer for 'window-text-pixel-size' right away. Can you try that? Finally, the (frame-pixel-width) argument looks fishy too - it should probably be (frame-pixel-width (window-frame window)). Can you verify that as well? Thanks, martin