2

I have the following in my .emacs:

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

And

(add-hook 'window-setup-hook
      (lambda ()
        (find-file "FILE.org")
        (shell)))

However, these buffers open with one on top, and one on the bottom. As far as I can tell, the window-setup-hook is supposed to be run after all frame parameters, so these really should be side by side. If I manually maximize the frame, and then do these two commands in order, it opens them side by side. Any ideas?

EDIT: following Stefan's suggestion, I have submitted a bug report.

1

Emacs reads the .emacs after creating the initial frame, and after that it looks at default-frame-alist (and others) to see if it changed and then tries to update the initial frame accordingly. This update happens fairly late in the startup sequence, so apparently after running window-setup-hook.

If you're running Emacs≥27, you can set default-frame-alist in your ~/.emacs.d/early-init.el, so it takes effect even before the initial frame is created, thus completely avoiding these kinds of problems.

  • 1
    According to the documentation here: gnu.org/software/emacs/manual/html_node/elisp/…, window-setup-hook is supposed to run after setting up the frame parameters (step 27 vs step 26). As far as I can tell, this is why window-setup-hook is even a thing. – extremeaxe5 Mar 30 at 18:09
  • @extremeaxe5: Indeed, and the code in lisp/startup.el seems to agrees with the doc, so I'm not sure what is the actual origin of the problem. It probably deserves a bug report. – Stefan Mar 30 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.