- case UNSHOW_BUFFER:
- {
- if (EQ (p->buffer, obj))
- {
- /* Find another buffer to show in this window. */
- Lisp_Object another_buffer =
- Fother_buffer (obj, Qnil, Qnil);
- if (NILP (another_buffer))
- another_buffer
- = Fget_buffer_create (QSscratch);
- /* If this window is dedicated, and in a frame
- of its own, kill the frame. */
- if (EQ (w, FRAME_ROOT_WINDOW (w_frame))
- && !NILP (p->dedicated)
- && other_visible_frames (w_frame))
- {
- /* Skip the other windows on this frame.
- There might be one, the minibuffer! */
- if (! EQ (w, last_window))
- while (w_frame == XFRAME (WINDOW_FRAME
- (XWINDOW (next_window))))
- {
- /* As we go, check for the end of the
- loop. We mustn't start going
- around a second time. */
- if (EQ (next_window, last_window))
- {
- last_window = w;
- break;
- }
- next_window = Fnext_window (next_window,
- mini ? Qt : Qnil,
- frame_arg, Qt);
- }
- /* Now we can safely delete the frame. */
- delete_frame_internal (XFRAME (WINDOW_FRAME (p)),
- 0, 0, 0);
- }
- else
- {
- /* Otherwise show a different buffer in the
- window. */
- p->dedicated = Qnil;
- Fset_window_buffer (w, another_buffer);
- if (EQ (w, Fselected_window (Qnil)))
- Fset_buffer (p->buffer);
- }
- }
- break;
- }
-