# HG changeset patch # User Stefan Monnier # Date 1056669521 0 # Node ID c78e0c6e92aaa08e6c5b4d03406290fb90b480bc # Parent af3e05d19939e5844decb90b3ed4c4cd79078a65 (Fset_window_dedicated_p): Simplify. (display_buffer_1): Don't raise the win from which minibuf was entered. (temp_output_buffer_show): Don't assume BEG == 1. Simplify. (Fminibuffer_selected_window): Simplify. (delete_window): Update for new types. diff -r af3e05d19939 -r c78e0c6e92aa src/window.c --- a/src/window.c Thu Jun 26 23:18:07 2003 +0000 +++ b/src/window.c Thu Jun 26 23:18:41 2003 +0000 @@ -1119,10 +1119,7 @@ { register struct window *w = decode_window (window); - if (NILP (arg)) - w->dedicated = Qnil; - else - w->dedicated = Qt; + w->dedicated = arg; return w->dedicated; } @@ -1381,8 +1378,8 @@ if (!NILP (tem)) { unshow_buffer (p); - unchain_marker (p->pointm); - unchain_marker (p->start); + unchain_marker (XMARKER (p->pointm)); + unchain_marker (XMARKER (p->start)); } /* Free window glyph matrices. It is sure that they are allocated @@ -2922,6 +2919,9 @@ return Qnil; } +/* Note that selected_window can be nil + when this is called from Fset_window_configuration. */ + DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer. If WINDOW is not already selected, also make WINDOW's buffer current. @@ -3021,7 +3021,14 @@ FRAME_SAMPLE_VISIBILITY (f); - if (!EQ (frame, selected_frame)) + if (EQ (frame, selected_frame)) + ; /* Assume the selected frame is already visible enough. */ + else if (minibuf_level > 0 + && MINI_WINDOW_P (XWINDOW (selected_window)) + && WINDOW_LIVE_P (minibuf_selected_window) + && EQ (frame, WINDOW_FRAME (XWINDOW (minibuf_selected_window)))) + ; /* Assume the frame from which we invoked the minibuffer is visible. */ + else { if (FRAME_ICONIFIED_P (f)) Fmake_frame_visible (frame); @@ -3328,37 +3335,31 @@ w = XWINDOW (window); XSETFASTINT (w->hscroll, 0); XSETFASTINT (w->min_hscroll, 0); - set_marker_restricted_both (w->start, buf, 1, 1); - set_marker_restricted_both (w->pointm, buf, 1, 1); + set_marker_restricted_both (w->start, buf, BEG, BEG); + set_marker_restricted_both (w->pointm, buf, BEG, BEG); /* Run temp-buffer-show-hook, with the chosen window selected and its buffer current. */ - if (!NILP (Vrun_hooks)) + + if (!NILP (Vrun_hooks) + && !NILP (Fboundp (Qtemp_buffer_show_hook)) + && !NILP (Fsymbol_value (Qtemp_buffer_show_hook))) { - Lisp_Object tem; - tem = Fboundp (Qtemp_buffer_show_hook); - if (!NILP (tem)) - { - tem = Fsymbol_value (Qtemp_buffer_show_hook); - if (!NILP (tem)) - { - int count = SPECPDL_INDEX (); - Lisp_Object prev_window, prev_buffer; - prev_window = selected_window; - XSETBUFFER (prev_buffer, old); - - /* Select the window that was chosen, for running the hook. - Note: Both Fselect_window and select_window_norecord may - set-buffer to the buffer displayed in the window, - so we need to save the current buffer. --stef */ - record_unwind_protect (Fset_buffer, prev_buffer); - record_unwind_protect (select_window_norecord, prev_window); - Fselect_window (window, Qt); - Fset_buffer (w->buffer); - call1 (Vrun_hooks, Qtemp_buffer_show_hook); - unbind_to (count, Qnil); - } - } + int count = SPECPDL_INDEX (); + Lisp_Object prev_window, prev_buffer; + prev_window = selected_window; + XSETBUFFER (prev_buffer, old); + + /* Select the window that was chosen, for running the hook. + Note: Both Fselect_window and select_window_norecord may + set-buffer to the buffer displayed in the window, + so we need to save the current buffer. --stef */ + record_unwind_protect (Fset_buffer, prev_buffer); + record_unwind_protect (select_window_norecord, prev_window); + Fselect_window (window, Qt); + Fset_buffer (w->buffer); + call1 (Vrun_hooks, Qtemp_buffer_show_hook); + unbind_to (count, Qnil); } } } @@ -4818,7 +4819,6 @@ { if (minibuf_level > 0 && MINI_WINDOW_P (XWINDOW (selected_window)) - && !NILP (minibuf_selected_window) && WINDOW_LIVE_P (minibuf_selected_window)) return minibuf_selected_window;