aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1991-07-27 06:54:44 +0000
committerJim Blandy1991-07-27 06:54:44 +0000
commit43bad9918a91877e1361d76544e0e5e78a0b998d (patch)
tree3387e1e2e9ebe64789173da61c841f314461b767 /src
parent0f79a4ae8f8e27e88a9588c501f7d7d4b40b3204 (diff)
downloademacs-43bad9918a91877e1361d76544e0e5e78a0b998d.tar.gz
emacs-43bad9918a91877e1361d76544e0e5e78a0b998d.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/minibuf.c41
-rw-r--r--src/window.c96
2 files changed, 79 insertions, 58 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index f7065f85b6e..d7d7fd08516 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -99,8 +99,8 @@ read_minibuf (map, initial, prompt, backup_n, expflag)
99{ 99{
100 register Lisp_Object val; 100 register Lisp_Object val;
101 int count = specpdl_ptr - specpdl; 101 int count = specpdl_ptr - specpdl;
102 Lisp_Object mini_screen = WINDOW_SCREEN (XWINDOW (minibuf_window));
102 struct gcpro gcpro1, gcpro2; 103 struct gcpro gcpro1, gcpro2;
103 Lisp_Object prev_screen = Qnil;
104 104
105 if (XTYPE (prompt) != Lisp_String) 105 if (XTYPE (prompt) != Lisp_String)
106 prompt = build_string (""); 106 prompt = build_string ("");
@@ -137,10 +137,11 @@ read_minibuf (map, initial, prompt, backup_n, expflag)
137 137
138 /* If the minibuffer window is on a different screen, save that 138 /* If the minibuffer window is on a different screen, save that
139 screen's configuration too. */ 139 screen's configuration too. */
140 if (XSCREEN (WINDOW_SCREEN (XWINDOW (minibuf_window))) 140 if (XSCREEN (mini_screen) != selected_screen)
141 != selected_screen) 141 {
142 record_unwind_protect (Fset_window_configuration, 142 record_unwind_protect (Fset_window_configuration,
143 Fcurrent_window_configuration (WINDOW_SCREEN (XWINDOW (minibuf_window)))); 143 Fcurrent_window_configuration (mini_screen));
144 }
144 145
145 val = current_buffer->directory; 146 val = current_buffer->directory;
146 Fset_buffer (get_minibuffer (minibuf_level)); 147 Fset_buffer (get_minibuffer (minibuf_level));
@@ -148,6 +149,24 @@ read_minibuf (map, initial, prompt, backup_n, expflag)
148 Fmake_local_variable (Qprint_escape_newlines); 149 Fmake_local_variable (Qprint_escape_newlines);
149 print_escape_newlines = 1; 150 print_escape_newlines = 1;
150 151
152#ifdef MULTI_SCREEN
153 /* If the minibuffer window is on another screen, shift this screen's
154 focus to that window, and arrange to put it back later. */
155 if (XSCREEN (WINDOW_SCREEN (XWINDOW (minibuf_window)))
156 != selected_screen)
157 {
158 record_unwind_protect (read_minibuf_unwind,
159 Fcons (Fselected_screen (),
160 SCREEN_FOCUS_SCREEN (selected_screen)));
161
162 Fredirect_screen_focus (Fselected_screen (), mini_screen);
163 }
164 else
165 record_unwind_protect (read_minibuf_unwind, Qnil);
166#else
167 record_unwind_protect (read_minibuf_unwind, Qnil);
168#endif
169
151 Vminibuf_scroll_window = selected_window; 170 Vminibuf_scroll_window = selected_window;
152 Fset_window_buffer (minibuf_window, Fcurrent_buffer ()); 171 Fset_window_buffer (minibuf_window, Fcurrent_buffer ());
153 Fselect_window (minibuf_window); 172 Fselect_window (minibuf_window);
@@ -155,7 +174,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag)
155 174
156 Ferase_buffer (); 175 Ferase_buffer ();
157 minibuf_level++; 176 minibuf_level++;
158 record_unwind_protect (read_minibuf_unwind, Qnil);
159 177
160 if (!NULL (initial)) 178 if (!NULL (initial))
161 { 179 {
@@ -188,7 +206,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag)
188 val = make_string (BEG_ADDR, Z - BEG); 206 val = make_string (BEG_ADDR, Z - BEG);
189 bcopy (GAP_END_ADDR, XSTRING (val)->data + GPT - BEG, Z - GPT); 207 bcopy (GAP_END_ADDR, XSTRING (val)->data + GPT - BEG, Z - GPT);
190 unbind_to (count, Qnil); /* The appropriate screen will get selected 208 unbind_to (count, Qnil); /* The appropriate screen will get selected
191 from set-window-configuration. */ 209 in set-window-configuration. */
192 210
193 UNGCPRO; 211 UNGCPRO;
194 212
@@ -238,7 +256,8 @@ get_minibuffer (depth)
238 and it restores the current window, buffer, etc. */ 256 and it restores the current window, buffer, etc. */
239 257
240void 258void
241read_minibuf_unwind () 259read_minibuf_unwind (data)
260 Lisp_Object data;
242{ 261{
243 /* Erase the minibuffer we were using at this level. */ 262 /* Erase the minibuffer we were using at this level. */
244 Fset_buffer (XWINDOW (minibuf_window)->buffer); 263 Fset_buffer (XWINDOW (minibuf_window)->buffer);
@@ -259,6 +278,12 @@ read_minibuf_unwind ()
259 minibuf_prompt_width = minibuf_save_vector[minibuf_level].prompt_width; 278 minibuf_prompt_width = minibuf_save_vector[minibuf_level].prompt_width;
260 Vhelp_form = minibuf_save_vector[minibuf_level].help_form; 279 Vhelp_form = minibuf_save_vector[minibuf_level].help_form;
261 Vcurrent_prefix_arg = minibuf_save_vector[minibuf_level].current_prefix_arg; 280 Vcurrent_prefix_arg = minibuf_save_vector[minibuf_level].current_prefix_arg;
281
282#ifdef MULTI_SCREEN
283 /* Redirect the focus of the screen that called the minibuffer. */
284 if (CONSP (data))
285 Fredirect_screen_focus (XCONS (data)->car, XCONS (data)->cdr);
286#endif
262} 287}
263 288
264DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 5, 0, 289DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 5, 0,
diff --git a/src/window.c b/src/window.c
index 8c5d5fd7f26..7685c0de3a5 100644
--- a/src/window.c
+++ b/src/window.c
@@ -18,8 +18,6 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs; see the file COPYING. If not, write to 18along with GNU Emacs; see the file COPYING. If not, write to
19the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 19the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20 20
21#include <stdio.h>
22
23#include "config.h" 21#include "config.h"
24#include "lisp.h" 22#include "lisp.h"
25#include "buffer.h" 23#include "buffer.h"
@@ -28,7 +26,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
28#include "commands.h" 26#include "commands.h"
29#include "indent.h" 27#include "indent.h"
30#include "termchar.h" 28#include "termchar.h"
31#include "termhooks.h"
32#include "disptab.h" 29#include "disptab.h"
33 30
34Lisp_Object Qwindowp; 31Lisp_Object Qwindowp;
@@ -87,10 +84,10 @@ int window_min_width;
87int pop_up_windows; 84int pop_up_windows;
88 85
89/* Nonzero implies make new X screens for Fdisplay_buffer. */ 86/* Nonzero implies make new X screens for Fdisplay_buffer. */
90int auto_new_screen; 87int pop_up_screens;
91 88
92/* Non-nil means use this function instead of default */ 89/* Non-nil means use this function instead of default */
93Lisp_Object Vauto_new_screen_function; 90Lisp_Object Vpop_up_screen_function;
94 91
95/* Function to call to handle Fdisplay_buffer. */ 92/* Function to call to handle Fdisplay_buffer. */
96Lisp_Object Vdisplay_buffer_function; 93Lisp_Object Vdisplay_buffer_function;
@@ -1395,24 +1392,13 @@ before each command.")
1395 1392
1396 selected_window = window; 1393 selected_window = window;
1397#ifdef MULTI_SCREEN 1394#ifdef MULTI_SCREEN
1398 /* If we're selecting the minibuffer window of the selected screen, 1395 if (XSCREEN (WINDOW_SCREEN (w)) != selected_screen)
1399 don't change the selected screen, even if the minibuffer is on
1400 a different screen. */
1401 if (XSCREEN (WINDOW_SCREEN (w)) != selected_screen
1402 && ! EQ (SCREEN_MINIBUF_WINDOW (selected_screen), window))
1403 { 1396 {
1404 XSCREEN (WINDOW_SCREEN (w))->selected_window = window; 1397 XSCREEN (WINDOW_SCREEN (w))->selected_window = window;
1405 Fselect_screen (WINDOW_SCREEN (w), Qnil); 1398 Fselect_screen (WINDOW_SCREEN (w), Qnil);
1406 } 1399 }
1407 else 1400 else
1408 selected_screen->selected_window = window; 1401 selected_screen->selected_window = window;
1409
1410 /* When using the global minibuffer screen, we want the highlight to
1411 go to the minibuffer's screen, and when we finish, we want the highlight
1412 to return to the original screen. Call the hook to put the highlight
1413 where it belongs. */
1414 if (screen_rehighlight_hook)
1415 (*screen_rehighlight_hook) ();
1416#endif 1402#endif
1417 1403
1418 record_buffer (w->buffer); 1404 record_buffer (w->buffer);
@@ -1465,33 +1451,33 @@ Returns the window displaying BUFFER.")
1465 return window; 1451 return window;
1466 1452
1467#ifdef MULTI_SCREEN 1453#ifdef MULTI_SCREEN
1468 if (auto_new_screen) 1454 /* If there are no screens open that have more than a minibuffer,
1455 we need to create a new screen. */
1456 if (pop_up_screens || last_nonminibuf_screen == 0)
1469 { 1457 {
1470 window 1458 window
1471 = Fscreen_selected_window (NULL (Vauto_new_screen_function) 1459 = Fscreen_selected_window (call0 (Vpop_up_screen_function));
1472 ? Fx_create_screen (Qnil)
1473 : call0 (Vauto_new_screen_function));
1474 Fset_window_buffer (window, buffer); 1460 Fset_window_buffer (window, buffer);
1475#if 0 1461#if 0
1476 Fselect_screen (XWINDOW (window)->screen, Qnil); 1462 Fselect_screen (XWINDOW (window)->screen, Qnil);
1477#endif 1463#endif
1478 return window; 1464 return window;
1479 } 1465 }
1480#endif /* MULTI_SCREEN */ 1466#endif /* MULTI_SCREEN */
1481 1467
1482 if (pop_up_windows) 1468 if (pop_up_windows
1469#ifdef MULTI_SCREEN
1470 || EQ (SCREEN_ROOT_WINDOW (selected_screen),
1471 SCREEN_MINIBUF_WINDOW (selected_screen))
1472#endif
1473 )
1483 { 1474 {
1475 Lisp_Object screens = Qnil;
1476
1484#ifdef MULTI_SCREEN 1477#ifdef MULTI_SCREEN
1485 /* When minibuffer screen is used, this is the previous screen. 1478 if (EQ (SCREEN_ROOT_WINDOW (selected_screen),
1486 Declared in minibuffer.c */ 1479 SCREEN_MINIBUF_WINDOW (selected_screen)))
1487 extern struct screen *active_screen; 1480 XSET (screens, Lisp_Screen, last_nonminibuf_screen);
1488 Lisp_Object screens;
1489
1490 if (active_screen)
1491 XSET (screens, Lisp_Screen, active_screen);
1492 else
1493 screens = Qnil;
1494
1495#endif 1481#endif
1496 /* Don't try to create a window if would get an error */ 1482 /* Don't try to create a window if would get an error */
1497 if (split_height_threshold < window_min_height << 1) 1483 if (split_height_threshold < window_min_height << 1)
@@ -2241,7 +2227,7 @@ by `current-window-configuration' (which see).")
2241 register Lisp_Object tem; 2227 register Lisp_Object tem;
2242 Lisp_Object new_current_buffer; 2228 Lisp_Object new_current_buffer;
2243 int k; 2229 int k;
2244 SCREEN_PTR s, screen_to_select; 2230 SCREEN_PTR s;
2245 2231
2246 while (XTYPE (arg) != Lisp_Window_Configuration) 2232 while (XTYPE (arg) != Lisp_Window_Configuration)
2247 { 2233 {
@@ -2271,7 +2257,7 @@ by `current-window-configuration' (which see).")
2271 /* Mark all windows now on screen as "deleted". 2257 /* Mark all windows now on screen as "deleted".
2272 Restoring the new configuration "undeletes" any that are in it. */ 2258 Restoring the new configuration "undeletes" any that are in it. */
2273 2259
2274 delete_all_subwindows (XWINDOW (s->root_window)); 2260 delete_all_subwindows (XWINDOW (SCREEN_ROOT_WINDOW (s)));
2275#if 0 2261#if 0
2276 /* This loses when the minibuf screen is not s. */ 2262 /* This loses when the minibuf screen is not s. */
2277 delete_all_subwindows (XWINDOW (XWINDOW (minibuf_window)->prev)); 2263 delete_all_subwindows (XWINDOW (XWINDOW (minibuf_window)->prev));
@@ -2491,35 +2477,46 @@ save_window_save (window, vector, i)
2491} 2477}
2492 2478
2493DEFUN ("current-window-configuration", 2479DEFUN ("current-window-configuration",
2494 Fcurrent_window_configuration, Scurrent_window_configuration, 0, 0, 0, 2480 Fcurrent_window_configuration, Scurrent_window_configuration, 0, 1, 0,
2495 "Return an object representing Emacs' current window configuration.\n\ 2481 "Return an object representing the current window configuration of SCREEN.\n\
2482If SCREEN is nil or omitted, use the selected screen.\n\
2496This describes the number of windows, their sizes and current buffers,\n\ 2483This describes the number of windows, their sizes and current buffers,\n\
2497and for each displayed buffer, where display starts, and the positions of\n\ 2484and for each displayed buffer, where display starts, and the positions of\n\
2498point and mark. An exception is made for point in the current buffer:\n\ 2485point and mark. An exception is made for point in the current buffer:\n\
2499its value is -not- saved.") 2486its value is -not- saved.")
2500 () 2487 (screen)
2488 Lisp_Object screen;
2501{ 2489{
2502 register Lisp_Object tem; 2490 register Lisp_Object tem;
2503 register int n_windows; 2491 register int n_windows;
2504 register struct save_window_data *data; 2492 register struct save_window_data *data;
2505 register int i; 2493 register int i;
2494 SCREEN_PTR s;
2495
2496 if (NULL (screen))
2497 s = selected_screen;
2498 else
2499 {
2500 CHECK_SCREEN (screen, 0);
2501 s = XSCREEN (screen);
2502 }
2506 2503
2507 n_windows = count_windows (XWINDOW (SCREEN_ROOT_WINDOW (selected_screen))); 2504 n_windows = count_windows (XWINDOW (SCREEN_ROOT_WINDOW (s)));
2508 data = (struct save_window_data *) 2505 data = (struct save_window_data *)
2509 XVECTOR (Fmake_vector (make_number (SAVE_WINDOW_DATA_SIZE), 2506 XVECTOR (Fmake_vector (make_number (SAVE_WINDOW_DATA_SIZE),
2510 Qnil)); 2507 Qnil));
2511 XFASTINT (data->screen_width) = SCREEN_WIDTH (selected_screen); 2508 XFASTINT (data->screen_width) = SCREEN_WIDTH (s);
2512 XFASTINT (data->screen_height) = SCREEN_HEIGHT (selected_screen); 2509 XFASTINT (data->screen_height) = SCREEN_HEIGHT (s);
2513 data->current_window = selected_window; 2510 data->current_window = SCREEN_SELECTED_WINDOW (s);
2514 XSET (data->current_buffer, Lisp_Buffer, current_buffer); 2511 XSET (data->current_buffer, Lisp_Buffer, current_buffer);
2515 data->minibuf_scroll_window = Vminibuf_scroll_window; 2512 data->minibuf_scroll_window = Vminibuf_scroll_window;
2516 data->root_window = SCREEN_ROOT_WINDOW (selected_screen); 2513 data->root_window = SCREEN_ROOT_WINDOW (s);
2517 tem = Fmake_vector (make_number (n_windows), Qnil); 2514 tem = Fmake_vector (make_number (n_windows), Qnil);
2518 data->saved_windows = tem; 2515 data->saved_windows = tem;
2519 for (i = 0; i < n_windows; i++) 2516 for (i = 0; i < n_windows; i++)
2520 XVECTOR (tem)->contents[i] 2517 XVECTOR (tem)->contents[i]
2521 = Fmake_vector (make_number (SAVED_WINDOW_VECTOR_SIZE), Qnil); 2518 = Fmake_vector (make_number (SAVED_WINDOW_VECTOR_SIZE), Qnil);
2522 save_window_save (SCREEN_ROOT_WINDOW (selected_screen), 2519 save_window_save (SCREEN_ROOT_WINDOW (s),
2523 XVECTOR (tem), 0); 2520 XVECTOR (tem), 0);
2524 XSET (tem, Lisp_Window_Configuration, data); 2521 XSET (tem, Lisp_Window_Configuration, data);
2525 return (tem); 2522 return (tem);
@@ -2538,7 +2535,7 @@ Does not restore the value of point in current buffer.")
2538 register int count = specpdl_ptr - specpdl; 2535 register int count = specpdl_ptr - specpdl;
2539 2536
2540 record_unwind_protect (Fset_window_configuration, 2537 record_unwind_protect (Fset_window_configuration,
2541 Fcurrent_window_configuration ()); 2538 Fcurrent_window_configuration (Qnil));
2542 val = Fprogn (args); 2539 val = Fprogn (args);
2543 return unbind_to (count, val); 2540 return unbind_to (count, val);
2544} 2541}
@@ -2630,18 +2627,17 @@ SCREEN-PART is one of the following symbols:\n\
2630 Vother_window_scroll_buffer = Qnil; 2627 Vother_window_scroll_buffer = Qnil;
2631 2628
2632#ifdef MULTI_SCREEN 2629#ifdef MULTI_SCREEN
2633 DEFVAR_BOOL ("auto-new-screen", &auto_new_screen, 2630 DEFVAR_BOOL ("pop-up-screens", &pop_up_screens,
2634 "*Non-nil means `display-buffer' should make a separate X-window."); 2631 "*Non-nil means `display-buffer' should make a separate X-window.");
2635 auto_new_screen = 0; 2632 pop_up_screens = 0;
2636 2633
2637 DEFVAR_LISP ("auto-new-screen-function", &Vauto_new_screen_function, 2634 DEFVAR_LISP ("pop-up-screen-function", &Vpop_up_screen_function,
2638 "*If non-nil, function to call to handle automatic new screen creation.\n\ 2635 "*If non-nil, function to call to handle automatic new screen creation.\n\
2639It is called with no arguments and should return a newly created screen.\n\ 2636It is called with no arguments and should return a newly created screen.\n\
2640nil means call `x-create-screen' with a nil argument.\n\
2641\n\ 2637\n\
2642A typical value might be `(lambda () (x-create-screen auto-screen-parms))'\n\ 2638A typical value might be `(lambda () (x-create-screen auto-screen-parms))'\n\
2643where `auto-screen-parms' would hold the default screen parameters."); 2639where `auto-screen-parms' would hold the default screen parameters.");
2644 Vauto_new_screen_function = Qnil; 2640 Vpop_up_screen_function = Qnil;
2645#endif 2641#endif
2646 2642
2647 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows, 2643 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows,