emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Functions transpose/rotate/flip windows


From: Pranshu Sharma
Subject: Re: Functions transpose/rotate/flip windows
Date: Wed, 15 Jan 2025 04:05:39 +1000
User-agent: Gnus/5.13 (Gnus v5.13)

martin rudalics <rudalics@gmx.at> writes:

>> New patch fixes behavior for dedicated windows in rotate-windows.
>
> Where is it?

Good question...

Ok, I attached it now.

diff --git a/lisp/window-x.el b/lisp/window-x.el
index 0411400917e..14009db1223 100644
--- a/lisp/window-x.el
+++ b/lisp/window-x.el
@@ -165,11 +165,17 @@ rotate-windows
 selected window."
   (interactive (list (window--rotate-interactive-arg)))
   (when (or (not window) (window-live-p window))
-    (user-error "No windows to transpose"))
+    (user-error "No windows to rotate"))
   (let* ((frame (window-frame window))
         (selected-window (frame-selected-window window))
         (win-tree (car (window-tree-normal-sizes window)))
-        (winls (seq-filter #'window-live-p (flatten-list win-tree)))
+        (winls (or
+                 (seq-filter
+                  (lambda (win)
+                    (and (window-live-p win)
+                         (not (window-dedicated-p win))))
+                  (flatten-list win-tree))
+                 (user-error "All windows are dedicated")))
         (rotated-ls (if reverse
                         (append (cdr winls) (list (car winls)))
                       (append (last winls) winls)))
@@ -181,7 +187,9 @@ rotate-windows
           (named-let rec ((tree win-tree))
             (cond
              ((consp tree) (cons (rec (car tree)) (rec (cdr tree))))
-             ((window-live-p tree) (pop rotated-ls))
+             ((and (window-live-p tree)
+                   (not (window-dedicated-p tree)))
+              (pop rotated-ls))
              (t tree)))))
     (when (or (seq-some #'window-atom-root winls)
              (seq-some #'window-fixed-size-p winls))
-- 
Pranshu Sharma <https://p.bauherren.ovh>

reply via email to

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