From unknown Mon Jun 23 04:12:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18498: 24.3.93; [PATCH] Fix fit-window-to-buffer's buffer width calculation Resent-From: Kan-Ru Chen (=?UTF-8?Q?=E9=99=B3=E4=BE=83=E5=A6=82?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Sep 2014 09:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18498 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 18498@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.141103382014437 (code B ref -1); Thu, 18 Sep 2014 09:51:01 +0000 Received: (at submit) by debbugs.gnu.org; 18 Sep 2014 09:50:20 +0000 Received: from localhost ([127.0.0.1]:43954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUYLz-0003km-Tz for submit@debbugs.gnu.org; Thu, 18 Sep 2014 05:50:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51559) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUYLw-0003kd-Jj for submit@debbugs.gnu.org; Thu, 18 Sep 2014 05:50:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUYLp-00079u-Gp for submit@debbugs.gnu.org; Thu, 18 Sep 2014 05:50:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:60877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUYLp-00074L-Es for submit@debbugs.gnu.org; Thu, 18 Sep 2014 05:50:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUYIJ-0002OH-0S for bug-gnu-emacs@gnu.org; Thu, 18 Sep 2014 05:46:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUYID-0006Av-Cj for bug-gnu-emacs@gnu.org; Thu, 18 Sep 2014 05:46:30 -0400 Received: from zmmta1.corp.phx1.mozilla.com ([63.245.216.72]:51100 helo=mail.mozilla.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUYID-000684-7T for bug-gnu-emacs@gnu.org; Thu, 18 Sep 2014 05:46:25 -0400 Received: from mail.mozilla.com (localhost6.localdomain [127.0.0.1]) by zmmta1.mail.corp.phx1.mozilla.com (Postfix) with ESMTPS id BCD37106454 for ; Thu, 18 Sep 2014 02:46:18 -0700 (PDT) Received: from kanru-mozilla.corp.tpe1.mozilla.com (zlb1.mail.corp.phx1.mozilla.com [10.20.77.200]) (Authenticated sender: kchen@mozilla.com) by zmmta1.mail.corp.phx1.mozilla.com (Postfix) with ESMTPSA id 87931106443 for ; Thu, 18 Sep 2014 02:46:18 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=kanru-mozilla.corp.tpe1.mozilla.com) by kanru-mozilla.corp.tpe1.mozilla.com with esmtp (Exim 4.80) (envelope-from ) id 1XUYIh-0001Lh-4p for bug-gnu-emacs@gnu.org; Thu, 18 Sep 2014 17:46:55 +0800 From: Kan-Ru Chen (=?UTF-8?Q?=E9=99=B3=E4=BE=83=E5=A6=82?=) Date: Thu, 18 Sep 2014 17:46:55 +0800 Message-ID: <87k351uupc.fsf@kanru-mozilla.corp.tpe1.mozilla.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain To reproduce: emacs -Q --eval '(progn (setq fit-window-to-buffer-horizontally t) (set-frame-size nil 120 20) (with-current-buffer-window "*scratch*" nil nil (insert (make-string 20 ?x)) (insert (make-string 10 ?\n)) (insert (make-string 90 ?x)) (split-window-horizontally) (fit-window-to-buffer) (message "window width: %d" (window-width))))' Expected result: window width: 90 Actual result: window width: 20 Patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-fit-window-to-buffer-s-buffer-width-calculation.patch >From 3bcdeb847e579981229b065b8dbd01722a94fc18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan-Ru=20Chen=20=28=E9=99=B3=E4=BE=83=E5=A6=82=29?= Date: Thu, 18 Sep 2014 17:36:54 +0800 Subject: Fix fit-window-to-buffer's buffer width calculation * window.el (fit-window-to-buffer): When counting buffer width, count the whole visible buffer. Correctly convert the body-height to pixel size for window-text-pixel-size. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c82b6f7..9096b92 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,8 +1,14 @@ +2014-09-18 Kan-Ru Chen + + * window.el (fit-window-to-buffer): When counting buffer width, + count the whole visible buffer. Correctly convert the body-height + to pixel size for window-text-pixel-size. + 2014-09-14 Glenn Morris * image.el (image-multi-frame-p): Fix thinko - do not force a delay if none was specified. (Bug#18334) 2014-09-12 Kan-Ru Chen * window.el (fit-window-to-buffer): Doc fix. diff --git a/lisp/window.el b/lisp/window.el index 4dc30ff..c547725 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7296,17 +7296,17 @@ accessible position." (width (+ (car (window-text-pixel-size nil (window-start) (point-max) (frame-pixel-width) ;; Add one char-height to assure that ;; we're on the safe side. This ;; overshoots when the first line below ;; the bottom is wider than the window. (* body-height - (if pixelwise char-height 1)))) + (if pixelwise 1 char-height)))) (window-right-divider-width)))) (unless pixelwise (setq width (/ (+ width char-width -1) char-width))) (unless (= width body-width) (window-resize-no-error window (- (max min-width (min max-width -- 1.9.1 --=-=-=-- From unknown Mon Jun 23 04:12:26 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Kan-Ru Chen (=?UTF-8?Q?=E9=99=B3=E4=BE=83=E5=A6=82?=) Subject: bug#18498: closed (Re: bug#18498: 24.3.93; [PATCH] Fix fit-window-to-buffer's buffer width calculation) Message-ID: References: <541ACB5B.3020306@gmx.at> <87k351uupc.fsf@kanru-mozilla.corp.tpe1.mozilla.com> X-Gnu-PR-Message: they-closed 18498 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 18498@debbugs.gnu.org Date: Thu, 18 Sep 2014 12:10:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1411042204-701-1" This is a multi-part message in MIME format... ------------=_1411042204-701-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #18498: 24.3.93; [PATCH] Fix fit-window-to-buffer's buffer width calculation which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 18498@debbugs.gnu.org. --=20 18498: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D18498 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1411042204-701-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 18498-done) by debbugs.gnu.org; 18 Sep 2014 12:09:14 +0000 Received: from localhost ([127.0.0.1]:44027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUaWP-0000A5-GJ for submit@debbugs.gnu.org; Thu, 18 Sep 2014 08:09:13 -0400 Received: from mout.gmx.net ([212.227.15.18]:50777) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUaWM-00009w-4g for 18498-done@debbugs.gnu.org; Thu, 18 Sep 2014 08:09:11 -0400 Received: from [188.22.237.86] ([188.22.237.86]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0Lj1jy-1Y1zbA1JPy-00dCoe; Thu, 18 Sep 2014 14:09:06 +0200 Message-ID: <541ACB5B.3020306@gmx.at> Date: Thu, 18 Sep 2014 14:08:59 +0200 From: martin rudalics MIME-Version: 1.0 To: =?UTF-8?B?Ikthbi1SdSBDaGVuICjpmbPkvoPlpoIpIg==?= , 18498-done@debbugs.gnu.org Subject: Re: bug#18498: 24.3.93; [PATCH] Fix fit-window-to-buffer's buffer width calculation References: <87k351uupc.fsf@kanru-mozilla.corp.tpe1.mozilla.com> In-Reply-To: <87k351uupc.fsf@kanru-mozilla.corp.tpe1.mozilla.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:7b9FfGf+OIjCyZWvoLHq2CP+D6I2ZHogk7Jpudm9r1sSbKUnz/6 P0tcsLdFDlKm02eMuPZaacL2PLicHVbAk2TyyCDzEMnzt9R0TmX4ST8xpW4YqEvIN16nftI kftHuFfn1tVrtOIVO0m2Mqj+tNyjn070NvkMPnWLDaGMlhVlitk1+lq5FNQpxj5rU/+peGA wa4weyhACwNT3zHhZAq0Q== X-UI-Out-Filterresults: notjunk:1; X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18498-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > Patch: Committed in revision 117506 of the emacs-24 branch. Bug closed. Thank you very much, martin ------------=_1411042204-701-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 18 Sep 2014 09:50:20 +0000 Received: from localhost ([127.0.0.1]:43954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUYLz-0003km-Tz for submit@debbugs.gnu.org; Thu, 18 Sep 2014 05:50:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51559) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUYLw-0003kd-Jj for submit@debbugs.gnu.org; Thu, 18 Sep 2014 05:50:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUYLp-00079u-Gp for submit@debbugs.gnu.org; Thu, 18 Sep 2014 05:50:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:60877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUYLp-00074L-Es for submit@debbugs.gnu.org; Thu, 18 Sep 2014 05:50:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUYIJ-0002OH-0S for bug-gnu-emacs@gnu.org; Thu, 18 Sep 2014 05:46:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUYID-0006Av-Cj for bug-gnu-emacs@gnu.org; Thu, 18 Sep 2014 05:46:30 -0400 Received: from zmmta1.corp.phx1.mozilla.com ([63.245.216.72]:51100 helo=mail.mozilla.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUYID-000684-7T for bug-gnu-emacs@gnu.org; Thu, 18 Sep 2014 05:46:25 -0400 Received: from mail.mozilla.com (localhost6.localdomain [127.0.0.1]) by zmmta1.mail.corp.phx1.mozilla.com (Postfix) with ESMTPS id BCD37106454 for ; Thu, 18 Sep 2014 02:46:18 -0700 (PDT) Received: from kanru-mozilla.corp.tpe1.mozilla.com (zlb1.mail.corp.phx1.mozilla.com [10.20.77.200]) (Authenticated sender: kchen@mozilla.com) by zmmta1.mail.corp.phx1.mozilla.com (Postfix) with ESMTPSA id 87931106443 for ; Thu, 18 Sep 2014 02:46:18 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=kanru-mozilla.corp.tpe1.mozilla.com) by kanru-mozilla.corp.tpe1.mozilla.com with esmtp (Exim 4.80) (envelope-from ) id 1XUYIh-0001Lh-4p for bug-gnu-emacs@gnu.org; Thu, 18 Sep 2014 17:46:55 +0800 From: =?utf-8?B?S2FuLVJ1IENoZW4gKOmZs+S+g+Wmgik=?= To: bug-gnu-emacs@gnu.org Subject: 24.3.93; [PATCH] Fix fit-window-to-buffer's buffer width calculation Date: Thu, 18 Sep 2014 17:46:55 +0800 Message-ID: <87k351uupc.fsf@kanru-mozilla.corp.tpe1.mozilla.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain To reproduce: emacs -Q --eval '(progn (setq fit-window-to-buffer-horizontally t) (set-frame-size nil 120 20) (with-current-buffer-window "*scratch*" nil nil (insert (make-string 20 ?x)) (insert (make-string 10 ?\n)) (insert (make-string 90 ?x)) (split-window-horizontally) (fit-window-to-buffer) (message "window width: %d" (window-width))))' Expected result: window width: 90 Actual result: window width: 20 Patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-fit-window-to-buffer-s-buffer-width-calculation.patch >From 3bcdeb847e579981229b065b8dbd01722a94fc18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan-Ru=20Chen=20=28=E9=99=B3=E4=BE=83=E5=A6=82=29?= Date: Thu, 18 Sep 2014 17:36:54 +0800 Subject: Fix fit-window-to-buffer's buffer width calculation * window.el (fit-window-to-buffer): When counting buffer width, count the whole visible buffer. Correctly convert the body-height to pixel size for window-text-pixel-size. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c82b6f7..9096b92 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,8 +1,14 @@ +2014-09-18 Kan-Ru Chen + + * window.el (fit-window-to-buffer): When counting buffer width, + count the whole visible buffer. Correctly convert the body-height + to pixel size for window-text-pixel-size. + 2014-09-14 Glenn Morris * image.el (image-multi-frame-p): Fix thinko - do not force a delay if none was specified. (Bug#18334) 2014-09-12 Kan-Ru Chen * window.el (fit-window-to-buffer): Doc fix. diff --git a/lisp/window.el b/lisp/window.el index 4dc30ff..c547725 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7296,17 +7296,17 @@ accessible position." (width (+ (car (window-text-pixel-size nil (window-start) (point-max) (frame-pixel-width) ;; Add one char-height to assure that ;; we're on the safe side. This ;; overshoots when the first line below ;; the bottom is wider than the window. (* body-height - (if pixelwise char-height 1)))) + (if pixelwise 1 char-height)))) (window-right-divider-width)))) (unless pixelwise (setq width (/ (+ width char-width -1) char-width))) (unless (= width body-width) (window-resize-no-error window (- (max min-width (min max-width -- 1.9.1 --=-=-=-- ------------=_1411042204-701-1--