[net.emacs] Emacs pops temp buffers into windows randomly: Fix.

thomas%UTAH-GR@utah-cs@sri-unix.UUCP (08/06/83)

From:  Spencer W. Thomas  <thomas%UTAH-GR@utah-cs>

Do the following, assuming buffer "bar" does not exist:
(start-process "loadst 2" "foo")
M-x execute-mlisp-line (progn (temp-use-buffer "bar") (get-tty-character))

After a couple of seconds, the buffer "bar" should pop up on the screen.

The problem is that stuff_buffer is putting a window on the current
buffer if it is invoked "interactively", without checking to see if
that buffer was in a window to begin with.  Here is a fix (line numbers
will be WAY off):
*** 374,377
  {
      struct buffer  *old_buffer = bf_cur;
  
  #ifdef HalfBaked

--- 377,381 -----
  {
      struct buffer  *old_buffer = bf_cur;
+     int old_buffer_is_visible = wn_cur->w_buf == bf_cur;
  
  #ifdef HalfBaked
***************
*** 392,396
  	DoDsp (1);
  	SetBfp (old_buffer);
! 	if (interactive)
  	    WindowOn (bf_cur);
      }

--- 396,400 -----
  	DoDsp (1);
  	SetBfp (old_buffer);
! 	if (interactive && old_buffer_is_visible)
  	    WindowOn (bf_cur);
      }

=Spencer