GNU bug report logs - #25380
25.1; save-window-excursion problem in batch mode

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Fri, 6 Jan 2017 23:06:02 UTC

Severity: normal

Found in version 25.1

Full log


Message #23 received at 25380 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: rgm <at> gnu.org, p.stephani2 <at> gmail.com, 25380 <at> debbugs.gnu.org
Subject: Re: bug#25380: 25.1; save-window-excursion problem in batch mode
Date: Mon, 09 Jan 2017 18:44:23 +0200
> Date: Mon, 09 Jan 2017 17:19:29 +0100
> From: martin rudalics <rudalics <at> gmx.at>
> CC: rgm <at> gnu.org, p.stephani2 <at> gmail.com, 25380 <at> 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.




This bug report was last modified 8 years and 213 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.