Search code examples
macosemacsosx-yosemiteemacs24

Why does Emacs leave a gap when trying to maximize the frame?


Ive installed Emacs via http://emacsformacosx.com/

In ~/.emacs.d/init.el

(tool-bar-mode -1)
(toggle-frame-maximized)

Which is supposed to maximize Emacs when it starts up. It does some kind of maximization, but leave a gap at the top (between the menubar, below the Apple logo). As you can see on the screenshot:

enter image description here

How do I ensure that Emacs fills up the screen.

PS, I am not looking from full-screen mode.


Solution

  • From C-h f toggle-frame-maximized:

    Note that with some window managers you may have to set `frame-resize-pixelwise' to non-nil in order to make a frame appear truly maximized.

    So in your init.el, do (setq frame-resize-pixelwise t) before toggling.

    In my experience, even after setting this variable to t, the first time I maximize, the frame is still not "truly" maximized. On subsequent calls to toggle-frame-maximized, the frame actually expands to fit.

    So here's the workaround...

    init.el:

    (tool-bar-mode -1)
    (setq frame-resize-pixelwise t)
    (dotimes (n 3)
      (toggle-frame-maximized))
    

    I would suggest that you turn off window animations so that you don't need to suffer through that ridiculous series of window resize animations on startup, but unfortunately the latest versions of Mac OS seem to have removed the ability to disable window animations.

    I suggest not using that OS. It is terrible.