martin rudalics writes: > > since you don't want to split parent windows. I decided to do this, since I also don't want my brain to start bleeding > I attach a file called window-rotate.el which handles the above > scenario. In contrast with a window tree it simply operates on the old > window structure of the frame directly which I store as an association > list. Note two aspects: > > (1) It always tries to find a leftmost live window to start operating > on. I think you do the same but I've never been able to understand how. From looking at the code, same reason as you. The leftmost top window is first window in a flattened window tree, then the recurisve descent started from there. The new function also does ame, but perfoms recursive ascent asc > (2) It binds 'window-combination-limit' to make a parent window within > something like the first combination you sketched above so this becomes > > |-------------| > | A | > |-------------| > | ----------- | > || B || > ||-----------|| > || C || > | ----------- | > |-------------| Wow! this is best thing since flush toilets, I was able to make the function work with this. Also, I plan on working on a cycle-windows function which will basiclly change window-tree so that that the layout isn't changed, but the windows are thing is. This will be able to be properly done using window--transpose-1, instead of window swap state which you said didn't work. > Half of the code is debugging code that is not commented. Note that the > code handles rotations only, rotates only the entire frame, does not set > sizes and probably misses other things. But it seems to work so please > test it and maybe try to use as much of it as possible. I looked at it, and could not really understnad it fully due to some low level stuff, but I got the idea and incoroperated some logic of windows-rotate. It seems like window-configurations are kind of being reinvented except in elisp, which is good. The function I made, I feel like my approach is higher level then yours cause I can't quite fully wrap my head around window management in emacs. So a lot of stuff, I don't know you can do. But on other hand, I feel the logic is also quite simpler, you can judge that.