On Fri, Feb 13, 2015 at 8:25 PM, martin rudalics wrote: > `init.el': >> >> (add-hook 'window-setup-hook 'toggle-frame-maximized t) >> (add-hook 'window-setup-hook 'toggle-frame-fullscreen t) >> > > Actually, this could never have worked. Emacs internally sets up a list > of parameters to be used for the initial frame and the second form just > annihilates any effect of the first. > > 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). >> > > In fact. Emacs never went to the maximized state so it can't return to > it. > > 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. >> > > The effect is the same as above. > > 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 (*). >> > > Because there's no fullscreen request that overrides it. > > 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. >> > > Indeed. These are two commands processed separately. > > 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. >> > > I've now implemented a couple of changes on trunk which allow to > memorize that parameter, which I renamed to `fullscreen-restore'. In > particular, using an equivalent of the following form in your init file > should accomplish what you want. > > (setq initial-frame-alist > '((fullscreen . fullboth) (fullscreen-restore . maximized))) > > Using `toggle-frame-fullscreen' and `toggle-frame-fullscreen' in the > initial file is confusing. These specify transitions rather than states > and an initial file should rather specify the desired initial state of a > frame. > > martin > ​Amazing. Thanks, Martin! This one can be definitely closed.​