From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25380: 25.1; save-window-excursion problem in batch mode Date: Mon, 09 Jan 2017 18:44:23 +0200 Message-ID: <83inpodvyw.fsf@gnu.org> References: <7qwpe5xusr.fsf@fencepost.gnu.org> <58735A58.80801@gmx.at> <83pojwi7qc.fsf@gnu.org> <5873B811.4000404@gmx.at> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1483980705 25490 195.159.176.226 (9 Jan 2017 16:51:45 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 9 Jan 2017 16:51:45 +0000 (UTC) Cc: p.stephani2@gmail.com, 25380@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 09 17:51:40 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQdAa-00063O-JK for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 Jan 2017 17:51:40 +0100 Original-Received: from localhost ([::1]:41152 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQdAf-0006rf-1e for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 Jan 2017 11:51:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQd4H-0001Yp-9d for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2017 11:45:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cQd4B-00063L-Af for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2017 11:45:09 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60820) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cQd4B-00063D-6j for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2017 11:45:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cQd4A-0008TN-DU for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2017 11:45:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Jan 2017 16:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25380 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25380-submit@debbugs.gnu.org id=B25380.148398027932528 (code B ref 25380); Mon, 09 Jan 2017 16:45:02 +0000 Original-Received: (at 25380) by debbugs.gnu.org; 9 Jan 2017 16:44:39 +0000 Original-Received: from localhost ([127.0.0.1]:47986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQd3n-0008SZ-J5 for submit@debbugs.gnu.org; Mon, 09 Jan 2017 11:44:39 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58699) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQd3l-0008SM-J4 for 25380@debbugs.gnu.org; Mon, 09 Jan 2017 11:44:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cQd3d-0005RQ-4A for 25380@debbugs.gnu.org; Mon, 09 Jan 2017 11:44:32 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45639) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQd3d-0005RD-0m; Mon, 09 Jan 2017 11:44:29 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1379 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cQd3b-0001eD-UO; Mon, 09 Jan 2017 11:44:28 -0500 In-reply-to: <5873B811.4000404@gmx.at> (message from martin rudalics on Mon, 09 Jan 2017 17:19:29 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:127936 Archived-At: > Date: Mon, 09 Jan 2017 17:19:29 +0100 > From: martin rudalics > CC: rgm@gnu.org, p.stephani2@gmail.com, 25380@debbugs.gnu.org > > >> IIUC the pixel comes from a menubar line which gets spuriously added. > > > > I believe you are right, see the backtrace below from the place which > > changes the value from 0 to 1 (it's not pixel units, btw, it's > > character units, AFAIU). > > At the time the comparison fails in ‘compare-window-configurations’ it's > at !EQ (sw1->pixel_top, sw2->pixel_top) so it's off by one pixel. It > probably would fail later at !EQ (sw1->top_line, sw2->top_line) as well. Yes, but in a batch session 1 pixel = 1 character (it's not a GUI session), right? > > More accurately, the initial current-window-configuration call happens > > so early that the basic geometry of the "windows" is not yet set, and > > in particular the menu bar is not yet computed and accounted for. > > This is indeed where Emacs 25 behaves differently from previous > > versions, and for a very good reason. > > Does the basic geometry of the "windows" ever get set? Would I have to > create a frame manually for that? Yes. No. > >> If someone told me how to debug this, I might be able to tell more. > > > > I just ran Emacs under a debugger with a breakpoint in > > Fcurrent_window_configuration, then put a watchpoint on every top_line > > member of every window that got saved there, and waited for it to > > break. > > That's obvious. But how do I find out where that menubar line gets set? I will see what I can do about that. > >> I have no idea how the frame seen by ‘current-window-configuration’ > >> gets created in batch mode. > > > > It comes from temacs, AFAIR. > > Hmm... the normal "F1" frame made by ‘make_initial_frame’. Still: Who > adds the menubar line? AFAIK neither NS nor GTK should. It's a batch session, so the text-mode part is probably the one. > > emacs -batch -eval "(progn (save-window-excursion (current-window-configuration)) (print (equal (save-window-excursion (current-window-configuration)) (current-window-configuration))))" => t > > emacs -batch -eval "(progn (menu-bar-mode -1) (print (equal (save-window-excursion (current-window-configuration)) (current-window-configuration))))" > > works here too. Of course. Like I said: trickery.