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: Pranshu Sharma
Subject: Re: Add function to rotate/transpose all windows
Date: Tue, 19 Nov 2024 19:34:11 +1000
User-agent: Gnus/5.13 (Gnus v5.13)

martin rudalics <rudalics@gmx.at> writes:

>> I can't quite get it to work, imagine this scinario:
>>
>> +-----+------+
>> | A   |__B___|
>> |     |  C   |
>> +-----+------+
>>
>> What the above split does is that is splits A, with refer B, and these
>> windows aren't really siblings.  So if I do pass the refer of A and B,
>> it should be from A's parent, but then when I pass B with refer (cons C
>> (B and C's parent)), won't it bug out since B's parent is being set twice?
>
> I tell you what I'm doing here: Let's call P the original parent of A
> and Q that of B and C.  The first split is a "first child" below split
> with A as window to split and a cons of B and P as REFER.  The second
> split is a "next sibling" left split with B as window to split and a
> cons of C and Q as REFER.  Both splits are done with combination limit
> set to t.
>

Thanks, the whole explenation really helped me, I now fixed the thing so
that it preserves parents windows as well.  I tested it with the:
C-x {3 2 o o 2} grid split and the parent window's were same before and
after transposing.



> BTW if you bind 'window-combination-limit' to t don't forget to reset
> it's effect for the parent window via
>
> (set-window-combination-limit parent limit)
>
> right after the split.  Otherwise the parent window cannot be recombined
> later on although that would be principally possible.

This means I will need this information provided at runtime of the
windows--transpose-1 function, meaning it will have to go in the tree.

I had a look at the window combination limit functoin, and it does not
work on a dead window.  The code for that function is:

{
  struct window *w;

  CHECK_VALID_WINDOW (window);
  w = XWINDOW (window);
  if (WINDOW_LEAF_P (w))
    error ("Combination limit is meaningful for internal windows only");
  return w->combination_limit;
}

Now, iiuc, there is some `window' struct which has the combination
limit variable.  So when the window is dead, the struct still exists as
long as lisp object exists, so I don't see any technical reason on not
being able to get the window-combination-limit of a dead window.  It
would be helpful if this and alike functions would be able to work on
dead windows.

Attachment: window-transpose.el
Description: application/emacs-lisp


reply via email to

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