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, 19 Nov 2024 18:48:45 +0100
User-agent: Mozilla Thunderbird

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

Good.  It already works with my standard scenario.  It does not yet work
with

C-x 2 C-x o C-x 3 C-x 3

which gets me from

((#<window 15 on *foo*> . #<window 16>)
 (#<window 18 on *foo*> . #<window 16>)
 (#<window 17 on *foo*> . #<window 16>)
 (#<window 11 on *foo*> . #<window 14>))

before

((#<window 15 on *foo*> . #<window 19>)
 (#<window 18 on *foo*> . #<window 19>)
 (#<window 17 on *foo*> . #<window 16>)
 (#<window 11 on *foo*> . #<window 14>))

after 'rotate-windows-clockwise'.  Initially, the parent window 16 hat
three children 15, 18, 17 afterwards 15 and 18 got a new parent 19.

I suppose you have to do the same I did: When calling 'split-window' do
_not_ set the combination limit when the window to split has a previous
sibling with the same parent as the window to split.  window-rotate.el
uses

                  (or limit
                      (not prev)
                      (not (eq (window-alist-parent prev)
                               (window-alist-parent window)))))

where 'prev' is the previous sibling of the window to split.

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

I have done that here for a couple of functions but for historical
reasons it will never work for 'window-buffer', 'window-top-child' and
'window-left-child'.  My code for 'window-combination-limit' is:

DEFUN ("window-combination-limit", Fwindow_combination_limit, 
Swindow_combination_limit, 1, 1, 0,
       doc: /* Return combination limit of window WINDOW.
WINDOW can be any internal window - a window that does not show a buffer
and has not shown a buffer before.  If the return value is nil, child
windows of WINDOW can be recombined with WINDOW's siblings.  A return
value of t means that child windows of WINDOW are never (re-)combined
with WINDOW's siblings.  */)
  (Lisp_Object window)
{
  struct window *w = decode_any_window (window);

  if (WINDOW_LEAF_P (w) || !NILP (w->old_buffer))
    error ("Combination limit is meaningful for internal windows only");

  return w->combination_limit;
}

martin




reply via email to

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