I have a bunch of one off functions to do frame/window layout. But an issue I run into is that if I do, say
(set-frame-size (selected-frame) 255 80)
(some-other-function-that-looks-at-frame-size-to-split-windows)
Half the time the resize hasn’t finished by the time the split function runs, and so it splits incorrectly. I’m assuming the resize happens asynchronously, but I don’t see a hook or event I can make use of to make sure I’m splitting after the fact. Is there something I’m missing? Sleeping doesn’t seem to fix it because that just delays the resize as well.
Set a
window-configuration-change-hook
temporarily, see if the(selected-frame)
matches. If so do the split, and remove the hook.I think you can do (sit-for 0) which will force a redisplay, after which, hopefully, your frame will be resized.
That worked! This is the easy answer, I really appreciate it.