GNU bug report logs - #35059
window-setup-hook not working with the new frame parameters

Previous Next

Package: emacs;

Reported by: JohnMichaelWu <at> gmail.com

Date: Sun, 31 Mar 2019 07:18:02 UTC

Severity: normal

Tags: notabug

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35059 in the body.
You can then email your comments to 35059 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#35059; Package emacs. (Sun, 31 Mar 2019 07:18:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to JohnMichaelWu <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 31 Mar 2019 07:18:03 GMT) Full text and rfc822 format available.

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

From: Michael Wu <john.michael.wu <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: window-setup-hook not working with the new frame parameters
Date: Sun, 31 Mar 2019 01:57:18 -0400
[Message part 1 (text/plain, inline)]
See this StackOverflow thread:
https://emacs.stackexchange.com/questions/48645/if-start-with-maximized-frame-why-do-windows-open-top-bottom-not-side-by-side

as well as Stefan's answer, and comments on that answer. Essentially, I
do not believe window-setup-hook is properly running after all frame
parameters have been set, as is suggested in the documentation here:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Startup-Summary.html



In GNU Emacs 26.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.23.2)
 of 2018-08-13 built on buildvm-13.phx2.fedoraproject.org
Windowing system distributor 'Fedora Project', version 11.0.12003000
System Description: Fedora release 29 (Twenty Nine)

Recent messages:
Wrote /home/OP/core/mind/sys/proc/as.md
Saving file /home/OP/core/mind/sys/proc/as.md...
Wrote /home/OP/core/mind/sys/proc/as.md
Saving file /home/OP/core/mind/sys/proc/main.org...
Wrote /home/OP/core/mind/sys/proc/main.org
command-execute: Command attempted to use minibuffer while in minibuffer
Quit [2 times]
C-x C-g is undefined
Mark set
Making completion list...

Configured using:
 'configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
 --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
 --with-gpm=no --with-xwidgets --with-modules
 build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu
 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Werror=format-security
 -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
 -fstack-protector-strong -grecord-gcc-switches
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
 -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
 LDFLAGS=-Wl,-z,relro
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY ACL
LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS XWIDGETS LCMS2

Important settings:
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t

Load-path shadows:
/usr/share/asymptote/asy-keywords hides
/usr/share/emacs/site-lisp/asymptote/asy-keywords
/usr/share/asymptote/asy-mode hides
/usr/share/emacs/site-lisp/asymptote/asy-mode
/usr/share/asymptote/asy-init hides
/usr/share/emacs/site-lisp/site-start.d/asy-init
/usr/share/emacs/site-lisp/site-start.d/maxima-modes hides
/usr/share/emacs/site-lisp/maxima/site_start.d/maxima-modes

Features:
(shadow sort emacsbug sendmail dired-aux mail-extr utop utop-minor-mode
pcase vc-git diff-mode apropos misearch multi-isearch pulse xref project
ruler-mode hl-line hexl pcmpl-unix pp cus-edit cus-start cus-load
cl-print eieio-opt speedbar sb-image ezimage dframe completion help-fns
radix-tree cl-extra help-mode markdown-mode color thingatpt shell
org-rmail org-mhe org-irc org-info org-gnus nnir gnus-sum gnus-group
gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls
utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range message rmc
puny rfc822 mml mml-sec epa derived epg mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus
nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
mail-utils mm-util mail-prsvr wid-edit org-docview doc-view jka-compr
image-mode dired dired-loaddefs org-bibtex bibtex org-bbdb org-w3m
org-element avl-tree generator org advice org-macro org-footnote
org-pcomplete pcomplete org-list org-faces org-entities noutline outline
easy-mmode org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob
ob-table ob-keys ob-exp ob-comint comint ansi-color ring ob-core ob-eval
org-compat org-macs org-loaddefs format-spec find-func cal-menu calendar
cal-loaddefs elec-pair edmacro kmacro server finder-inf tex-site
proof-site proof-autoloads pg-vars rx info package easymenu epg-config
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib emacs-goodies-loaddefs time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting xwidget-internal
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 436153 75706)
 (symbols 48 41249 2)
 (miscs 40 840 1305)
 (strings 32 141082 5579)
 (string-bytes 1 3831899)
 (vectors 16 49868)
 (vector-slots 8 1694714 196144)
 (floats 8 392 1080)
 (intervals 56 2214 433)
 (buffers 992 30))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35059; Package emacs. (Sun, 31 Mar 2019 08:21:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: JohnMichaelWu <at> gmail.com, Michael Wu <john.michael.wu <at> gmail.com>,
 35059 <at> debbugs.gnu.org
Subject: Re: bug#35059: window-setup-hook not working with the new frame
 parameters
Date: Sun, 31 Mar 2019 11:20:35 +0300
On March 31, 2019 8:57:18 AM GMT+03:00, Michael Wu <john.michael.wu <at> gmail.com> wrote:
> See this StackOverflow thread:
> https://emacs.stackexchange.com/questions/48645/if-start-with-maximized-frame-why-do-windows-open-top-bottom-not-side-by-side
> 
> as well as Stefan's answer, and comments on that answer. Essentially,
> I
> do not believe window-setup-hook is properly running after all frame
> parameters have been set, as is suggested in the documentation here:
> 
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Startup-Summary.html


There's nothing wrong with window-setup-hook, AFAICT, it indeed runs after all the parameters of the frame have been set according to your customizations.

The problem is in your apparent assumption that frame maximization happens immediately after you put the fullscreen parameter into frame-parametets.  But actually, frame maximization is performed through interaction with the window-manager, which generally happens asynchronously and takes some short, but non-zero time.

Add to your hook  a call to 'message' that displays the width and height of the selected window, and you will see why you get windows split vertically.

The conclusion is that if you want to see windows split like you expected, you need to insert a wait into your  emacs.  Or just split horizontally by an explicit command.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35059; Package emacs. (Tue, 18 Aug 2020 16:51:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Michael Wu <john.michael.wu <at> gmail.com>, JohnMichaelWu <at> gmail.com,
 35059 <at> debbugs.gnu.org
Subject: Re: bug#35059: window-setup-hook not working with the new frame
 parameters
Date: Tue, 18 Aug 2020 16:50:19 +0000
tags 35059 + notabug
close 35059
thanks

Eli Zaretskii <eliz <at> gnu.org> writes:

> On March 31, 2019 8:57:18 AM GMT+03:00, Michael Wu <john.michael.wu <at> gmail.com> wrote:
>> See this StackOverflow thread:
>> https://emacs.stackexchange.com/questions/48645/if-start-with-maximized-frame-why-do-windows-open-top-bottom-not-side-by-side
>>
>> as well as Stefan's answer, and comments on that answer. Essentially,
>> I
>> do not believe window-setup-hook is properly running after all frame
>> parameters have been set, as is suggested in the documentation here:
>>
>> https://www.gnu.org/software/emacs/manual/html_node/elisp/Startup-Summary.html
>
>
> There's nothing wrong with window-setup-hook, AFAICT, it indeed runs after all the parameters of the frame have been set according to your customizations.
>
> The problem is in your apparent assumption that frame maximization happens
> immediately after you put the fullscreen parameter into frame-parametets.  But
> actually, frame maximization is performed through interaction with the
> window-manager, which generally happens asynchronously and takes some short, but
> non-zero time.
>
> Add to your hook  a call to 'message' that displays the width and height of the selected window, and you will see why you get windows split vertically.
>
> The conclusion is that if you want to see windows split like you expected, you need to insert a wait into your  emacs.  Or just split horizontally by an explicit command.

No further updates within more than a year, so I'm closing this bug
report with the above explanation.

If this conclusion is incorrect, please reply to this email (use "Reply
to all" in your email client) and we can reopen the bug report.

Best regards,
Stefan Kangas




Added tag(s) notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 18 Aug 2020 16:51:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 35059 <at> debbugs.gnu.org and JohnMichaelWu <at> gmail.com Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 18 Aug 2020 16:51:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 16 Sep 2020 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 222 days ago.

Previous Next


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