Skip to content

Commit efd4fb5

Browse files
Pranshu SharmaMartin Rudalics
authored andcommitted
Do not rotate dedicated windows
* lisp/window-x.el (rotate-windows): Do not rotate windows dedicated to their buffers.
1 parent 4fada67 commit efd4fb5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lisp/window-x.el

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,17 @@ Interactively, a prefix argument says to rotate the parent window of the
165165
selected window."
166166
(interactive (list (window--rotate-interactive-arg)))
167167
(when (or (not window) (window-live-p window))
168-
(user-error "No windows to transpose"))
168+
(user-error "No windows to rotate"))
169169
(let* ((frame (window-frame window))
170170
(selected-window (frame-selected-window window))
171171
(win-tree (car (window-tree-normal-sizes window)))
172-
(winls (seq-filter #'window-live-p (flatten-list win-tree)))
172+
(winls (or
173+
(seq-filter
174+
(lambda (win)
175+
(and (window-live-p win)
176+
(not (window-dedicated-p win))))
177+
(flatten-list win-tree))
178+
(user-error "All windows are dedicated")))
173179
(rotated-ls (if reverse
174180
(append (cdr winls) (list (car winls)))
175181
(append (last winls) winls)))
@@ -181,7 +187,9 @@ selected window."
181187
(named-let rec ((tree win-tree))
182188
(cond
183189
((consp tree) (cons (rec (car tree)) (rec (cdr tree))))
184-
((window-live-p tree) (pop rotated-ls))
190+
((and (window-live-p tree)
191+
(not (window-dedicated-p tree)))
192+
(pop rotated-ls))
185193
(t tree)))))
186194
(when (or (seq-some #'window-atom-root winls)
187195
(seq-some #'window-fixed-size-p winls))

0 commit comments

Comments
 (0)