aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorJim Blandy1992-09-13 12:38:21 +0000
committerJim Blandy1992-09-13 12:38:21 +0000
commit83762ba49a6dba2c9dcfca26fe888a586f669a0f (patch)
tree4319c204b6b903abfbad5a4f96347da681d244e7 /src/window.c
parent4fbc0284b10a3613619bd7bcf8f0b3d7f839a8b5 (diff)
downloademacs-83762ba49a6dba2c9dcfca26fe888a586f669a0f.tar.gz
emacs-83762ba49a6dba2c9dcfca26fe888a586f669a0f.zip
* window.c (minibuffer_window): Accept an optional FRAME argument;
if specified, return the minibuffer used by that frame. * window.c (Fset_window_configuration): Don't signal an error if the frame size saved in the window configuration doesn't match the frame's current size; instead, temporarily resize the frame while installing the window configuration. This is important because using the minibuffer saves and restores the current window configuration, and you don't want to signal an error just because the user resized the frame while using the minibuffer.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/window.c b/src/window.c
index a5a5563fabb..2ae981aa07b 100644
--- a/src/window.c
+++ b/src/window.c
@@ -141,14 +141,21 @@ DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0,
141 return selected_window; 141 return selected_window;
142} 142}
143 143
144DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 0, 0, 144DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0,
145 "Return the window used now for minibuffers.") 145 "Return the window used now for minibuffers.\n\
146 () 146If the optional argument FRAME is specified, return the minibuffer window\n\
147used by that frame.")
148 (frame)
149 Lisp_Object frame;
147{ 150{
148#ifdef MULTI_FRAME 151#ifdef MULTI_FRAME
149 choose_minibuf_frame (); 152 if (NILP (frame))
150#endif /* MULTI_FRAME */ 153 XSET (frame, Lisp_Frame, selected_frame);
151 return minibuf_window; 154 else
155 CHECK_LIVE_FRAME (frame, 0);
156#endif
157
158 return FRAME_MINIBUF_WINDOW (XFRAME (frame));
152} 159}
153 160
154DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 1, 1, 0, 161DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 1, 1, 0,
@@ -2346,6 +2353,11 @@ by `current-window-configuration' (which see).")
2346 int k; 2353 int k;
2347 FRAME_PTR f; 2354 FRAME_PTR f;
2348 2355
2356 /* Save screen height here so we can go back to it at the end. */
2357 int previous_frame_height;
2358 int previous_frame_width;
2359 int frame_size_change;
2360
2349 while (XTYPE (configuration) != Lisp_Window_Configuration) 2361 while (XTYPE (configuration) != Lisp_Window_Configuration)
2350 { 2362 {
2351 configuration = wrong_type_argument (intern ("window-configuration-p"), 2363 configuration = wrong_type_argument (intern ("window-configuration-p"),
@@ -2360,12 +2372,14 @@ by `current-window-configuration' (which see).")
2360 if (XFASTINT (data->frame_height) != FRAME_HEIGHT (f) 2372 if (XFASTINT (data->frame_height) != FRAME_HEIGHT (f)
2361 || XFASTINT (data->frame_width) != FRAME_WIDTH (f)) 2373 || XFASTINT (data->frame_width) != FRAME_WIDTH (f))
2362 { 2374 {
2363 /* Presumably something clever could be done. 2375 previous_frame_height = FRAME_HEIGHT (f);
2364 However, it doesn't seem worth the effort */ 2376 previous_frame_width = FRAME_WIDTH (f);
2365 error ("Frame size %dx%d in saved window configuration mismatches frame.", 2377 frame_size_change = 1;
2366 XFASTINT (data->frame_height), 2378
2367 XFASTINT (data->frame_width)); 2379 change_frame_size (f, data->frame_height, data->frame_width, 0, 0);
2368 } 2380 }
2381 else
2382 frame_size_change = 0;
2369 2383
2370 windows_or_buffers_changed++; 2384 windows_or_buffers_changed++;
2371 new_current_buffer = data->current_buffer; 2385 new_current_buffer = data->current_buffer;
@@ -2468,6 +2482,10 @@ by `current-window-configuration' (which see).")
2468 Fselect_frame (WINDOW_FRAME (XWINDOW (data->root_window)), Qnil); 2482 Fselect_frame (WINDOW_FRAME (XWINDOW (data->root_window)), Qnil);
2469#endif 2483#endif
2470 2484
2485 /* Set the screen height to the value it had before this function. */
2486 if (frame_size_change)
2487 change_frame_size (f, previous_frame_height, previous_frame_width, 0, 0);
2488
2471 if (f == selected_frame) 2489 if (f == selected_frame)
2472 { 2490 {
2473 Fselect_window (data->current_window); 2491 Fselect_window (data->current_window);