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: Sat, 9 Nov 2024 09:48:20 +0100
User-agent: Mozilla Thunderbird

>> It wasn't magic - so far I was not able to make it work here.  In all
>> approaches that work here, I have to pass a (window . parent) cons to
>> 'split-window' as REFER argument.  I do no exclude that one can make it
>> work but it's not simple and very likely requires the normal window
>> handling routines to keep an old parent for each window around.
>
> Ah, I see.  This approach definetly seems better tho, cause there is no
> hidden stuff going on.

But the caller has to remember which parent was the old one and pass it
as argument.

> I attached the contents of foo, but with the simpler split of
> C-x 3 C-x o C-x 3  which still has the same error

I suspect you're testing an old version of window-rotate.el or the wrong
patch for 'split-window'.  I resend them both.

> I'll see if you can tell anything by looking at foo, otherwise I will
> have to do that.

This is definitively an old version.  The new version outputs something
like

((#<window 16 on *foo*> (buffer . #<buffer *foo*>)
           (parent . #<window 14>) (prev . #<window 15 on *foo*>)
           (next) (width . 0.25) (height . 1.0))
 (#<window 15 on *foo*> (buffer . #<buffer *foo*>)
           (parent . #<window 14>) (prev . #<window 11 on *foo*>)
           (next . #<window 16 on *foo*>) (width . 0.25)
           (height . 1.0))
 (#<window 11 on *foo*> (buffer . #<buffer *foo*>)
           (parent . #<window 14>) (prev)
           (next . #<window 15 on *foo*>) (width . 0.5) (height . 1.0))
 (#<window 14> (left . #<window 11 on *foo*>) (top) (parent) (prev)
           (next . #<window 4 on  *Minibuf-0*>)
           (first . #<window 11 on *foo*>) (width . 1.0)
           (height . 1.0) (combination-limit) (no-rotate)))

First #<window 11 on *foo*>
v #<window 11 on *foo*> N #<window 15> [nil|#<window 14>] S 385 T
v #<window 15 on *foo*> N #<window 16> [#<window 14>|#<window 14>] S 192 F

to *foo* where the last lines explain the 'split-window' calls and are
interpreted, from left to right

- "v" represents a split below ("^" above "<" left and ">" right are the
  other indicators)

- the window to split

- "N" is followed by the live window to recreate, a next sibling (it
  could also be "F" for first descendant)

- [|] specify the old and new parent of the window to split

- "S" is followed by the new size in pixels of the window to split

- a final "T" or "F" stand for the combination limit of the parent.

With C-x 3 C-x 3 there must be at least one line terminated by an "F"
which means a horizontal combination of at least three windows was made.
You can see that also in the parent windows that were used: The first
split resurrects window 14 as parent of 11 and 15.  The second split
reuses window 14 as new parent of windows 15 and 16.

> Looking at the code, you have not set the size argument yet, meaning that it
> sis splitting only half and half approach.
>
> When you do this you will see the flaw of splitting parent windows: When
> you split a parent window, all the child of the window being split are
> scaled equally.  Emacs does not handle this properly, for example look
> at the screenshot I attached, this is why I initally did not want to
> split parent windows.

Try again with the code I attached.

martin

Attachment: window-rotate.txt
Description: Text document

Attachment: split-window.diff
Description: Text Data


reply via email to

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