Subject: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows
From: Alexander Shukaev <[email-masked]>
To: bug-gnu-emacs <[email-masked]>
Date: Mon, 17 Nov 2014 09:13:56 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

`init.el':

(add-hook 'window-setup-hook 'toggle-frame-maximized t)
(add-hook 'window-setup-hook 'toggle-frame-fullscreen t)

does not work as expected. Emacs goes fullscreen indeed. However, running
manually `(toggle-frame-fullscreen)' once again after Emacs loaded, does
not bring Emacs into maximized state, it rather returns to a small initial
frame (of the default size, `emacs -q' to remind yourself how it looks
like). Changing `init.el' to:

(add-to-list 'default-frame-alist '(fullscreen . maximized))
(add-hook 'window-setup-hook 'toggle-frame-fullscreen t)

does not help either.

One could think that somehow `maximized' parameter is not set, but if one
has in `init.el' only:

(add-to-list 'default-frame-alist '(fullscreen . maximized))

or

(add-hook 'window-setup-hook 'toggle-frame-maximized t)

then Emacs is loaded into maximized state indeed (*).

On the other hand in `emacs -q', if one runs

(toggle-frame-maximized)
(toggle-frame-fullscreen)

manually, and then runs `(toggle-frame-fullscreen)' manually once again,
then Emacs is brought to maximized state.

All this makes me think that there is some problem with memorizing
`maximized' parameter during `window-setup-hook', but note that this
actually contradicts (*) what makes this problem even more confusing.

It's Emacs 24.4.50 on Windows.