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: Fri, 25 Oct 2024 00:38:02 +1000
User-agent: Gnus/5.13 (Gnus v5.13)

martin rudalics <rudalics@gmx.at> writes:

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

Sorry for late reply, been caught up with rl shit.

I had a skim look at this, will have a proper one tommorow or saturday,
and I think the problem of using flatten-list still exists.

I've made a new protoptype (buggy) of window--transpose-1 that does not
call flatten.

Right now, it works with this kind of split:

(let ((win (split-window (split-window nil nil t))))
  (dotimes (_ 4)
    (setq win (split-window win 10 t))
    ))
    
and:

(let ((win (split-window (split-window nil nil t))))
  (dotimes (_ 4)
    (setq win (split-window win 10 t))
    ))

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

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.

Attachment: isolate.el
Description: application/emacs-lisp


reply via email to

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