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.

  • JDRiverRun@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Set a window-configuration-change-hook temporarily, see if the (selected-frame) matches. If so do the split, and remove the hook.