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: Tue, 22 Oct 2024 20:12:18 +0200
User-agent: Mozilla Thunderbird

>> - Split *scratch* first with REFER *Messages* and then its parent with
>>    REFER *foo*.
>>
>> - Split *foo* first with REFER *scratch* and then *scratch* with REFER
>>    *Messages*.
>>
>
> Here, the second option is non feesible as it relies on #<window 222 on
> *foo*> being an actual window, not a window split.  Althouht it is
> possible with workarounds and I'll end up implimenting the first option
> trying to get the second to work.
>
> (t (0 1 148 31)
>      (nil (0 1 148 16) #<window 182 on *scratch*> #<window 224 on
>     *Messages*>)
>      #<window 222 on *foo*>)
>
> When I orignally wrote the transpose-windows-1, I didn't know about
> internal windows.
>
> Also I looked at your other message about window split internal, that
> should help a lot.

OK.  I looked into this again and maybe I can help you.  Attached find a
new version of 'split-window' that accepts also a (WINDOW . PARENT)
cons as REFER where WINDOW is the buffer window to use and PARENT its
parent before WINDOW was deleted.  How to use that is documented in the
version of window-transpose.el I also attach.  It's full of debugging
code so you have to figure out yourself how to make use of it.

The three crucial aspects are:

(1) It has a function 'window-alist' that establishes before transposing
anything an association list of all live windows with their parents and
stores it in the variable 'window-alist'.

(2) It deletes windows via 'delete-other-windows-internal'.

(3) When it calls 'split-window' then in the (listp win) case I set the
cdr of the cons to the old parent of the _window to split_ (found via
'window-alist').  In the win is a window case, I set the cdr of the cons
to the old parent of the _window to make_ (again found via
'window-alist').

This survives quite a number of 'rotate-windows-clockwise' on the three
windows structure I create on the bottom of window-transpose.el.

Try it and then maybe try it with your remaining functions in an
analogous manner.  The tricky part is certainly (3) which might just
work with my simple rotation scenario.

martin

Attachment: split-window-diff
Description: Text document

Attachment: window-transpose.el
Description: Text Data


reply via email to

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