kyle@UUNET.UU.NET (Kyle Jones) (01/18/91)
GNU Emacs version 18.55:
In src/window.c, inside the definition of window_loop, at the
part of the main switch statement that Freplace_buffer_in_windows
uses, we see
case 6:
if (EQ (p->buffer, obj))
{
tem = Fother_buffer (obj);
if (NULL (tem))
tem = Fget_buffer_create (build_string ("*scratch*"));
Fset_window_buffer (w, tem);
Fset_buffer (p->buffer);
}
break;
I think the call to Fset_buffer is a bug. Why does the current
buffer need to be changed here?
To illustrate the buggy behavior, consider this code:
(delete-other-windows)
(switch-to-buffer "aaa")
(split-window)
(switch-to-buffer "bbb")
(kill-buffer "aaa")
(message "%s" (current-buffer))
At this point the current buffer should still be "bbb", but it is
not. If you put this code into a file and run "emacs -q -l <file>",
you'll see #<buffer *scratch*> in the echo area. The bug nails
Fkill_buffer because it calls Freplace_buffer_in_windows which in
turn calls window_loop.