From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#17142: 24.4.50; Initial frame geometry on OSX Date: Sun, 30 Mar 2014 15:46:47 +0200 Message-ID: <53382047.2090805@gmx.at> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060501010403080409040800" X-Trace: ger.gmane.org 1396187249 2339 80.91.229.3 (30 Mar 2014 13:47:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Mar 2014 13:47:29 +0000 (UTC) To: Bernd Rellermeyer , 17142@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 30 15:47:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WUG54-0005j2-97 for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Mar 2014 15:47:22 +0200 Original-Received: from localhost ([::1]:44401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUG53-0003tw-Sd for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Mar 2014 09:47:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUG4s-0003tZ-Ph for bug-gnu-emacs@gnu.org; Sun, 30 Mar 2014 09:47:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUG4l-0008PW-8e for bug-gnu-emacs@gnu.org; Sun, 30 Mar 2014 09:47:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUG4l-0008PL-4V for bug-gnu-emacs@gnu.org; Sun, 30 Mar 2014 09:47:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WUG4k-0004Td-Jk for bug-gnu-emacs@gnu.org; Sun, 30 Mar 2014 09:47: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: Sun, 30 Mar 2014 13:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17142-submit@debbugs.gnu.org id=B17142.139618721817197 (code B ref 17142); Sun, 30 Mar 2014 13:47:02 +0000 Original-Received: (at 17142) by debbugs.gnu.org; 30 Mar 2014 13:46:58 +0000 Original-Received: from localhost ([127.0.0.1]:56841 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WUG4f-0004TJ-Dv for submit@debbugs.gnu.org; Sun, 30 Mar 2014 09:46:57 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:57832) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WUG4c-0004T6-IQ for 17142@debbugs.gnu.org; Sun, 30 Mar 2014 09:46:56 -0400 Original-Received: from [188.22.42.180] ([188.22.42.180]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0LwW8p-1X7moW2znz-018NuU; Sun, 30 Mar 2014 15:46:51 +0200 In-Reply-To: X-Provags-ID: V03:K0:PDLX3XRqp6AYxeGjtSAt0ndIqAjO6qAUo/9vkxRVQ9HfjuwIXAV 13tq0DlSUGHLsVfhtQecSrKToVYnIsIKhZI+51pxucHev9K6vXP8AJ+8Eqr1hsoJE6Rdl8r mkM/uvDFN20YOKrFne9/CcW2xb2zaJ0EtdIHjr98vRw0iEs8zr2CisRGosX93PVYyT8P1Ac C3huvNWK+a4K3t+wPrhzA== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:87556 Archived-At: This is a multi-part message in MIME format. --------------060501010403080409040800 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > When changing the default font and the height in default-frame-alist, > the width is not set correctly. I have the following lines in the > .emacs file: When processing frame parameters we initially recorded the old frame width first. The following font change requested by > (add-to-list 'default-frame-alist '(font . "Courier-14")) implicitly enlarged the frame width but the next size change requested by > (add-to-list 'default-frame-alist '(height . 71)) applies the old width recorded initially, discarding the width value implied by the new font size. This scenario > When I change my settings to > > (add-to-list 'default-frame-alist '(font . "Courier-14")) > (add-to-list 'default-frame-alist '(width . 80)) > (add-to-list 'default-frame-alist '(height . 71)) > > everything is fine. doesn't show the problem because it requests a new frame width as well, so the new value is used instead of the recorded old value. This scenario > When I change my settings to > > (add-to-list 'default-frame-alist '(font . "Courier-14")) > > leaving the height as ist is, the width of 80 characters per line is > also set correctly. doesn't show the problem because no explicit change of the frame size is requested, so none of the old recorded values gets applied. I checked in a fix on the emacs-24 release branch which will get merged to trunk sooner or later. If you are on trunk and want to test the fix immediately (recommended), please try the attached patch. Thanks once more for the recipe, martin --------------060501010403080409040800 Content-Type: text/plain; charset=windows-1252; name="frame.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="frame.c.diff" === modified file 'src/frame.c' --- src/frame.c 2014-03-20 14:09:37 +0000 +++ src/frame.c 2014-03-30 13:10:11 +0000 @@ -2795,6 +2795,7 @@ set them both at once. So we wait until we've looked at the entire list before we set them. */ int width, height; + bool width_change = 0, height_change = 0; /* Same here. */ Lisp_Object left, top; @@ -2810,7 +2811,6 @@ #ifdef HAVE_X_WINDOWS bool icon_left_no_change = 0, icon_top_no_change = 0; #endif - bool size_changed = 0; struct gcpro gcpro1, gcpro2; i = 0; @@ -2844,18 +2844,6 @@ top = left = Qunbound; icon_left = icon_top = Qunbound; - /* Provide default values for HEIGHT and WIDTH. */ - width = (f->new_width - ? (f->new_pixelwise - ? f->new_width - : (f->new_width * FRAME_COLUMN_WIDTH (f))) - : FRAME_TEXT_WIDTH (f)); - height = (f->new_height - ? (f->new_pixelwise - ? f->new_height - : (f->new_height * FRAME_LINE_HEIGHT (f))) - : FRAME_TEXT_HEIGHT (f)); - /* Process foreground_color and background_color before anything else. They are independent of other properties, but other properties (e.g., cursor_color) are dependent upon them. */ @@ -2897,12 +2885,12 @@ if (EQ (prop, Qwidth) && RANGED_INTEGERP (0, val, INT_MAX)) { - size_changed = 1; + width_change = 1; width = XFASTINT (val) * FRAME_COLUMN_WIDTH (f) ; } else if (EQ (prop, Qheight) && RANGED_INTEGERP (0, val, INT_MAX)) { - size_changed = 1; + height_change = 1; height = XFASTINT (val) * FRAME_LINE_HEIGHT (f); } else if (EQ (prop, Qtop)) @@ -2989,11 +2977,30 @@ XSETFRAME (frame, f); - if (size_changed + if ((width_change || height_change) && (width != FRAME_TEXT_WIDTH (f) || height != FRAME_TEXT_HEIGHT (f) || f->new_height || f->new_width)) - Fset_frame_size (frame, make_number (width), make_number (height), Qt); + { + /* If necessary provide default values for HEIGHT and WIDTH. Do + that here since otherwise a size change implied by an + intermittent font change may get lost as in Bug#17142. */ + if (!width_change) + width = (f->new_width + ? (f->new_pixelwise + ? f->new_width + : (f->new_width * FRAME_COLUMN_WIDTH (f))) + : FRAME_TEXT_WIDTH (f)); + + if (!height_change) + height = (f->new_height + ? (f->new_pixelwise + ? f->new_height + : (f->new_height * FRAME_LINE_HEIGHT (f))) + : FRAME_TEXT_HEIGHT (f)); + + Fset_frame_size (frame, make_number (width), make_number (height), Qt); + } if ((!NILP (left) || !NILP (top)) && ! (left_no_change && top_no_change) --------------060501010403080409040800--