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.

extremeaxe5
  • 639
  • 3
  • 10
  • In addition to the variables `split-width-threshold` and `split-height-threshold`, this thread may provide some insight: https://emacs.stackexchange.com/questions/39034/prefer-vertical-splits-over-horizontal-ones And, here is a link to a detailed answer I wrote up explaining how to display a `shell` buffer in any of four directions (above, below, left, right): https://emacs.stackexchange.com/a/28924/2287 – lawlist Mar 29 '19 at 05:17

1 Answers1

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.

Stefan
  • 26,154
  • 3
  • 46
  • 84
  • 1
    According to the documentation here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Startup-Summary.html, `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 '19 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 '19 at 19:10