From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#14326: 24.3; Conflict of w32-send-sys-command and set-default-font Date: Wed, 01 May 2013 18:02:01 +0300 Message-ID: <83a9oepwuu.fsf@gnu.org> References: <5180DD2B.3080407@gmx.at> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1367420626 3072 80.91.229.3 (1 May 2013 15:03:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 1 May 2013 15:03:46 +0000 (UTC) Cc: eenliu@gmail.com, 14326@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 01 17:03:42 2013 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 1UXYZI-0000yQ-0d for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 May 2013 17:03:40 +0200 Original-Received: from localhost ([::1]:60343 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXYZH-0004tA-Kz for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 May 2013 11:03:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXYZD-0004t4-3t for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 11:03:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXYZB-0004wk-RK for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 11:03:35 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXYZB-0004vI-N5 for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 11:03:33 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UXYZe-0005hg-De for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 11:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 May 2013 15:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14326 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: Original-Received: via spool by 14326-submit@debbugs.gnu.org id=B14326.136742061121834 (code B ref 14326); Wed, 01 May 2013 15:04:02 +0000 Original-Received: (at 14326) by debbugs.gnu.org; 1 May 2013 15:03:31 +0000 Original-Received: from localhost ([127.0.0.1]:54053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UXYZ8-0005g0-Ca for submit@debbugs.gnu.org; Wed, 01 May 2013 11:03:30 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:38525) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UXYZ4-0005fi-Et for 14326@debbugs.gnu.org; Wed, 01 May 2013 11:03:28 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MM400J00KDSQW00@a-mtaout20.012.net.il> for 14326@debbugs.gnu.org; Wed, 01 May 2013 18:02:09 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MM400J89KFGR000@a-mtaout20.012.net.il>; Wed, 01 May 2013 18:02:09 +0300 (IDT) In-reply-to: <5180DD2B.3080407@gmx.at> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.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:73869 Archived-At: > Date: Wed, 01 May 2013 11:15:23 +0200 > From: martin rudalics > Cc: 14326@debbugs.gnu.org > > > I am running Emacs 24.3 on Windows 7, with only two commands in my Emacs > > init file: > > (w32-send-sys-command 61488) ;; maximize frame at startup > > (set-default-font "Monaco-10") > > The first command works well alone, but it stops to maximize frame after > > the second one is > > added to init file. However, if eval them after Emacs starts up by M-x > > eval-expression, then (w32-send-sys-command 61488) still works. > > Does interchanging the order of these two lines change anything? I'd be surprised if it didn't. It does here. See below. > and what happens when you do > > (progn > (w32-send-sys-command 61488) ;; maximize frame at startup > (sit-for 1) > (set-default-font "Monaco-10")) > > instead? Doesn't work, either. Triggering redisplay doesn't help here. > Conceptually: Does anyone know whether sending a 61488 request to > Windows has Windows call us back with a maximize request? Of course, it does. (And the 61488 request is not sent to Windows, it is sent to our own window procedure.) Since we don't process the 61488 (a.k.a. WM_SYSCOMMAND) message, we get WM_SIZE as its result. Until we get that WM_SIZE message, our frame is not really maximized, and its dimensions are not reflected in the frame object's internals. So set-default-font uses the previous dimensions, and effectively resets or countermands the effect of w32-send-sys-command. Invoking the commands in the reverse order doesn't have this problem, because the effect of set-default-font is immediate. Moreover, I submit that the OP does not _want_ to invoke set-default-font after maximizing the frame, even if it did work. That's because changing the font of a maximized frame will either make it not maximized (if the new font is smaller) or make some of its parts, such as the minibuffer, invisible (if the font is larger). The machinery that maximizes the frame takes the font into account, so changing the font afterwards defeats what it does by invalidating all the pixel calculations Windows does using the previous font. IOW, this is not a bug, but rather a cockpit error. The correct way is to swap the order of these two lines.