]> git.eshelyaron.com Git - emacs.git/commitdiff
Do not rotate dedicated windows
authorPranshu Sharma <pranshu@bauherren.ovh>
Fri, 17 Jan 2025 15:35:43 +0000 (16:35 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 18 Jan 2025 22:00:28 +0000 (23:00 +0100)
* lisp/window-x.el (rotate-windows): Do not rotate windows
dedicated to their buffers.

(cherry picked from commit efd4fb51ec96b8ce8956fff2406de7a498ee6278)

lisp/window-x.el

index a81ed09cd49bcd9018468ae9a916f9599caae099..2b72f058553d6768a1dd335f703a6e3cb16a9099 100644 (file)
@@ -165,11 +165,17 @@ Interactively, a prefix argument says to rotate the parent window of the
 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 @@ selected window."
           (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))