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: Mon, 18 Nov 2024 01:03:53 +1000
User-agent: Gnus/5.13 (Gnus v5.13)

martin rudalics <rudalics@gmx.at> writes:

>> In this case, cwin was the undead window that exists.  I just had a bug
>> in delete-other-windows-internal where the WINDOW argument was nil.  I
>> just changed that, and didn't touch the window--transpose-1 code and it
>> works now.  Look in the attached file.
>
> OK.  Now to the problematic part:
>
>          (split-window cwin split-size
>                        split-type t
>                        ;; THIS IS WHERE IS GOES OF THE MAP spew
>                        (cons win (cdar subtree))
>                        ;; To get a basic working thing, comment above line 
> and uncoment below line
>                        ;; win
>
> Here window-rotate.el checks
>
>              (if (and (window-valid-p parent)
>                       (eq parent (window-parent window)))
>                  next
>                (cons next parent)))
>
> when processing the next window in a combination and
>
>            (if (and (window-valid-p parent)
>                     (eq parent (window-parent window)))
>                first
>              (cons first parent)))
>
> when descending to the first live child where
>
> - window is the window to split and
>
> - parent is the parent of window before 'delete-other-windows-internal'
>
> If parent has been already restored (has become valid again) you must
> not pass it as cdr of REFER since then 'split-window-internal' will
> complain with the error you've seen.  'split-window-internal' must
> reject that argument because otherwise it may even crash Emacs.
>
> So what you have to do is to pass only the former live window as REFER
> argument and not use a cons in that case.

Ok, I applied this and it works fine now.  Look in the file
attached.  Also checkout the cycle-windows function which I added in.  I
know I still have to deal with fixed size and atomic windows, but
otherwise it is looking fine now.

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


reply via email to

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