# HG changeset patch # User Gerd Moellmann # Date 982079067 0 # Node ID acd9eaaa94c1b010786c471328e0eaac48913d42 # Parent f160c7ab017b521e8abe56ea767d8ac9bb3837d8 (window_loop) : Prefer to return the selected window if it is showing the buffer in question. diff -r f160c7ab017b -r acd9eaaa94c1 src/window.c --- a/src/window.c Tue Feb 13 15:23:17 2001 +0000 +++ b/src/window.c Tue Feb 13 15:44:27 2001 +0000 @@ -1669,7 +1669,6 @@ (frame, minibuf, window) Lisp_Object frame, minibuf, window; { - if (NILP (window)) window = selected_window; if (NILP (frame)) @@ -1764,13 +1763,6 @@ else window = FRAME_SELECTED_WINDOW (SELECTED_FRAME ()); - /* Figure out the last window we're going to mess with. Since - Fnext_window, given the same options, is guaranteed to go in a - ring, we can just use Fprevious_window to find the last one. - - We can't just wait until we hit the first window again, because - it might be deleted. */ - windows = window_list_1 (window, mini ? Qt : Qnil, frame_arg); GCPRO1 (windows); best_window = Qnil; @@ -1799,8 +1791,12 @@ ? EQ (window, minibuf_window) : 1)) { - UNGCPRO; - return window; + if (NILP (best_window)) + best_window = window; + else if (EQ (window, selected_window)) + /* For compatibility with 20.x, prefer to return + selected-window. */ + best_window = window; } break;