Subject: bug#1276: 23.0.60; select_window_norecord chokes on dead window

From: martin rudalics <[email-masked]>
Date: Thu, 30 Oct 2008 12:39:58 +0100

To reproduce with emacs -Q evaluate the following form

(progn
    (setq debug-on-error t)
    (set-frame-height (selected-frame) 10)
    (split-window)
    (temp-buffer-resize-mode)
    (setq temp-buffer-max-height 20))

and do

    C-h v temp-buffer-max-height

Gets me

Debugger entered--Lisp error: (wrong-type-argument window-live-p #<window 3>)
    describe-variable(temp-buffer-max-height)
    call-interactively(describe-variable nil nil)

FWIW, the reason is that `fit-window-to-buffer' deletes prev_window
temp_output_buffer_show eventually wants to resurrect after running
`temp-buffer-show-hook'.  The attached patch fixes this for me.

martin, who thinks that `fit-window-to-buffer' shouldn't delete windows ...

*** window.c.~1.631.~	2008-10-29 10:29:14.718750000 +0100
--- window.c	2008-10-30 11:08:50.406250000 +0100
***************
*** 3643,3649 ****
  select_window_norecord (window)
       Lisp_Object window;
  {
!   return Fselect_window (window, Qt);
  }
  
  Lisp_Object
--- 3643,3650 ----
  select_window_norecord (window)
       Lisp_Object window;
  {
!   return WINDOW_LIVE_P (window)
!     ? Fselect_window (window, Qt) : selected_window;
  }
  
  Lisp_Object