comparison src/window.c @ 51674:c78e0c6e92aa

(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.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 26 Jun 2003 23:18:41 +0000
parents 3ee34a66739e
children 695cf19ef79e
comparison
equal deleted inserted replaced
51673:af3e05d19939 51674:c78e0c6e92aa
1117 (window, arg) 1117 (window, arg)
1118 Lisp_Object window, arg; 1118 Lisp_Object window, arg;
1119 { 1119 {
1120 register struct window *w = decode_window (window); 1120 register struct window *w = decode_window (window);
1121 1121
1122 if (NILP (arg)) 1122 w->dedicated = arg;
1123 w->dedicated = Qnil;
1124 else
1125 w->dedicated = Qt;
1126 1123
1127 return w->dedicated; 1124 return w->dedicated;
1128 } 1125 }
1129 1126
1130 DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, 1127 DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
1379 /* tem is null for dummy parent windows 1376 /* tem is null for dummy parent windows
1380 (which have inferiors but not any contents themselves) */ 1377 (which have inferiors but not any contents themselves) */
1381 if (!NILP (tem)) 1378 if (!NILP (tem))
1382 { 1379 {
1383 unshow_buffer (p); 1380 unshow_buffer (p);
1384 unchain_marker (p->pointm); 1381 unchain_marker (XMARKER (p->pointm));
1385 unchain_marker (p->start); 1382 unchain_marker (XMARKER (p->start));
1386 } 1383 }
1387 1384
1388 /* Free window glyph matrices. It is sure that they are allocated 1385 /* Free window glyph matrices. It is sure that they are allocated
1389 again when ADJUST_GLYPHS is called. Block input so that expose 1386 again when ADJUST_GLYPHS is called. Block input so that expose
1390 events and other events that access glyph matrices are not 1387 events and other events that access glyph matrices are not
2920 2917
2921 set_window_buffer (window, buffer, 1, !NILP (keep_margins)); 2918 set_window_buffer (window, buffer, 1, !NILP (keep_margins));
2922 return Qnil; 2919 return Qnil;
2923 } 2920 }
2924 2921
2922 /* Note that selected_window can be nil
2923 when this is called from Fset_window_configuration. */
2924
2925 DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, 2925 DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0,
2926 doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer. 2926 doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer.
2927 If WINDOW is not already selected, also make WINDOW's buffer current. 2927 If WINDOW is not already selected, also make WINDOW's buffer current.
2928 Also make WINDOW the frame's selected window. 2928 Also make WINDOW the frame's selected window.
2929 Optional second arg NORECORD non-nil means 2929 Optional second arg NORECORD non-nil means
3019 Lisp_Object frame = XWINDOW (window)->frame; 3019 Lisp_Object frame = XWINDOW (window)->frame;
3020 FRAME_PTR f = XFRAME (frame); 3020 FRAME_PTR f = XFRAME (frame);
3021 3021
3022 FRAME_SAMPLE_VISIBILITY (f); 3022 FRAME_SAMPLE_VISIBILITY (f);
3023 3023
3024 if (!EQ (frame, selected_frame)) 3024 if (EQ (frame, selected_frame))
3025 ; /* Assume the selected frame is already visible enough. */
3026 else if (minibuf_level > 0
3027 && MINI_WINDOW_P (XWINDOW (selected_window))
3028 && WINDOW_LIVE_P (minibuf_selected_window)
3029 && EQ (frame, WINDOW_FRAME (XWINDOW (minibuf_selected_window))))
3030 ; /* Assume the frame from which we invoked the minibuffer is visible. */
3031 else
3025 { 3032 {
3026 if (FRAME_ICONIFIED_P (f)) 3033 if (FRAME_ICONIFIED_P (f))
3027 Fmake_frame_visible (frame); 3034 Fmake_frame_visible (frame);
3028 else if (FRAME_VISIBLE_P (f)) 3035 else if (FRAME_VISIBLE_P (f))
3029 Fraise_frame (frame); 3036 Fraise_frame (frame);
3326 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); 3333 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
3327 Vminibuf_scroll_window = window; 3334 Vminibuf_scroll_window = window;
3328 w = XWINDOW (window); 3335 w = XWINDOW (window);
3329 XSETFASTINT (w->hscroll, 0); 3336 XSETFASTINT (w->hscroll, 0);
3330 XSETFASTINT (w->min_hscroll, 0); 3337 XSETFASTINT (w->min_hscroll, 0);
3331 set_marker_restricted_both (w->start, buf, 1, 1); 3338 set_marker_restricted_both (w->start, buf, BEG, BEG);
3332 set_marker_restricted_both (w->pointm, buf, 1, 1); 3339 set_marker_restricted_both (w->pointm, buf, BEG, BEG);
3333 3340
3334 /* Run temp-buffer-show-hook, with the chosen window selected 3341 /* Run temp-buffer-show-hook, with the chosen window selected
3335 and its buffer current. */ 3342 and its buffer current. */
3336 if (!NILP (Vrun_hooks)) 3343
3344 if (!NILP (Vrun_hooks)
3345 && !NILP (Fboundp (Qtemp_buffer_show_hook))
3346 && !NILP (Fsymbol_value (Qtemp_buffer_show_hook)))
3337 { 3347 {
3338 Lisp_Object tem; 3348 int count = SPECPDL_INDEX ();
3339 tem = Fboundp (Qtemp_buffer_show_hook); 3349 Lisp_Object prev_window, prev_buffer;
3340 if (!NILP (tem)) 3350 prev_window = selected_window;
3341 { 3351 XSETBUFFER (prev_buffer, old);
3342 tem = Fsymbol_value (Qtemp_buffer_show_hook); 3352
3343 if (!NILP (tem)) 3353 /* Select the window that was chosen, for running the hook.
3344 { 3354 Note: Both Fselect_window and select_window_norecord may
3345 int count = SPECPDL_INDEX (); 3355 set-buffer to the buffer displayed in the window,
3346 Lisp_Object prev_window, prev_buffer; 3356 so we need to save the current buffer. --stef */
3347 prev_window = selected_window; 3357 record_unwind_protect (Fset_buffer, prev_buffer);
3348 XSETBUFFER (prev_buffer, old); 3358 record_unwind_protect (select_window_norecord, prev_window);
3349 3359 Fselect_window (window, Qt);
3350 /* Select the window that was chosen, for running the hook. 3360 Fset_buffer (w->buffer);
3351 Note: Both Fselect_window and select_window_norecord may 3361 call1 (Vrun_hooks, Qtemp_buffer_show_hook);
3352 set-buffer to the buffer displayed in the window, 3362 unbind_to (count, Qnil);
3353 so we need to save the current buffer. --stef */
3354 record_unwind_protect (Fset_buffer, prev_buffer);
3355 record_unwind_protect (select_window_norecord, prev_window);
3356 Fselect_window (window, Qt);
3357 Fset_buffer (w->buffer);
3358 call1 (Vrun_hooks, Qtemp_buffer_show_hook);
3359 unbind_to (count, Qnil);
3360 }
3361 }
3362 } 3363 }
3363 } 3364 }
3364 } 3365 }
3365 3366
3366 static void 3367 static void
4816 Returns nil, if current window is not a minibuffer window. */) 4817 Returns nil, if current window is not a minibuffer window. */)
4817 () 4818 ()
4818 { 4819 {
4819 if (minibuf_level > 0 4820 if (minibuf_level > 0
4820 && MINI_WINDOW_P (XWINDOW (selected_window)) 4821 && MINI_WINDOW_P (XWINDOW (selected_window))
4821 && !NILP (minibuf_selected_window)
4822 && WINDOW_LIVE_P (minibuf_selected_window)) 4822 && WINDOW_LIVE_P (minibuf_selected_window))
4823 return minibuf_selected_window; 4823 return minibuf_selected_window;
4824 4824
4825 return Qnil; 4825 return Qnil;
4826 } 4826 }