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: Sun, 17 Nov 2024 11:22:22 +0100
User-agent: Mozilla Thunderbird

> 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.  I've tried with

              (split-window
               cwin
               split-size
               split-type
               t
               (progn
                 (while (listp (caaddr win))
                   (setq win (caddr win)))
                 (if (and (window-valid-p (cdar win))
                          (eq (cdar win) (window-parent (caaddr win))))
                     (caaddr win)
                 (cons (caaddr win) (cdar win)))))

and

           (split-window cwin split-size
                         split-type t
                         ;; THIS IS WHERE IS GOES OF THE MAP spew
                         (if (and (window-valid-p (cdar subtree))
                                  (eq (cdar subtree) (window-parent win)))
                             win
                           (cons win (cdar subtree)))
                         ;; To get a basic working thing, comment above line 
and uncoment below line
                         ;; win
                         ))))

and they seem to work.

martin




reply via email to

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