emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add function to rotate/transpose all windows


From: martin rudalics
Subject: Re: Add function to rotate/transpose all windows
Date: Thu, 24 Oct 2024 20:39:17 +0200
User-agent: Mozilla Thunderbird

> However, not on the one achived by:
> C-x 3
> C-x o
> C-x 2
> C-x 3

Yes, this one is a bit nasty.

> I did make some progress on this, but the problem was there was no way I know
> to achive this, which makes it a bit harder:
>
> |-------------|      |-------------|
> |      A      |      |      A      |
> |-------------|      |-------------|
> |       B     | ->   |  B   |      |
> |-------------|      |------|   D  |
> |      C      |      |   C  |      |
> |-------------|      |-------------|
>
> I'm sure there is way to make it work without this, I'll probably come
> up with way in shower.

Maybe you should have done

|-------------|      |-------------|
|      A      |      |      A      |
|-------------|      |-------------|
|      |      | ->   |   B  |      |
|  B   |   D  |      |------|   D  |
|      |      |      |   C  |      |
|-------------|      |-------------|

since you don't want to split parent windows.

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.

(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     ||
| ----------- |
|-------------|

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.

martin

Attachment: window-rotate.el
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]