diff --git a/lisp/window.el b/lisp/window.el index 016d53ffbdd..5994b6816ef 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4356,10 +4356,7 @@ delete-other-windows (error "Root of atomic window is root window of its frame") (throw 'done (delete-other-windows atom-root)))) ((window-parameter window 'window-side) - (error "Cannot make side window the only window")) - ((and (window-minibuffer-p window) - (not (eq window (frame-root-window window)))) - (error "Can't expand minibuffer to full frame"))) + (error "Cannot make side window the only window"))) (cond ((or ignore-window-parameters @@ -4395,15 +4392,21 @@ delete-other-windows (error nil)))) (throw 'done nil))) - ;; If WINDOW is the main window of its frame do nothing. - (if (eq window main) - ;; Give a message to the user if this has been called as a - ;; command. - (when (and interactive - (not (or executing-kbd-macro noninteractive))) - (message "No other windows to delete")) + (cond + ;; If WINDOW is the main window of its frame do nothing. + ((eq window main) + ;; Give a message to the user if this has been called as a + ;; command. + (when (and interactive + (not (or executing-kbd-macro noninteractive))) + (message "No other windows to delete"))) + ((and (window-minibuffer-p window) + (not (eq window (frame-root-window window)))) + (user-error "Can't expand minibuffer to full frame")) + (t (delete-other-windows-internal window main) - (window--check frame)) + (window--check frame))) + ;; Always return nil. nil)))