comparison src/minibuf.c @ 358:71c9042fb90d

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Sat, 27 Jul 1991 06:54:44 +0000
parents 8633e6928acc
children 22e3aeabf1e9
comparison
equal deleted inserted replaced
357:1ad871406b12 358:71c9042fb90d
97 Lisp_Object backup_n; 97 Lisp_Object backup_n;
98 int expflag; 98 int 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 ("");
107 107
108 /* Emacs in -batch mode calls minibuffer: print the prompt. */ 108 /* Emacs in -batch mode calls minibuffer: print the prompt. */
135 record_unwind_protect (Fset_window_configuration, 135 record_unwind_protect (Fset_window_configuration,
136 Fcurrent_window_configuration (Qnil)); 136 Fcurrent_window_configuration (Qnil));
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));
147 current_buffer->directory = val; 148 current_buffer->directory = val;
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);
154 XFASTINT (XWINDOW (minibuf_window)->hscroll) = 0; 173 XFASTINT (XWINDOW (minibuf_window)->hscroll) = 0;
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 {
162 Finsert (1, &initial); 180 Finsert (1, &initial);
163 if (!NULL (backup_n) && XTYPE (backup_n) == Lisp_Int) 181 if (!NULL (backup_n) && XTYPE (backup_n) == Lisp_Int)
186 204
187 /* Make minibuffer contents into a string */ 205 /* Make minibuffer contents into a string */
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
195 /* VAL is the string of minibuffer text. */ 213 /* VAL is the string of minibuffer text. */
196 214
236 254
237 /* This function is called on exiting minibuffer, whether normally or not, 255 /* This function is called on exiting minibuffer, whether normally or not,
238 and it restores the current window, buffer, etc. */ 256 and it restores the current window, buffer, etc. */
239 257
240 void 258 void
241 read_minibuf_unwind () 259 read_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);
245 264
246 /* Prevent error in erase-buffer. */ 265 /* Prevent error in erase-buffer. */
257 /* Restore prompt from outer minibuffer */ 276 /* Restore prompt from outer minibuffer */
258 minibuf_prompt = minibuf_save_vector[minibuf_level].prompt; 277 minibuf_prompt = minibuf_save_vector[minibuf_level].prompt;
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
264 DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 5, 0, 289 DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 5, 0,
265 "Read a string from the minibuffer, prompting with string PROMPT.\n\ 290 "Read a string from the minibuffer, prompting with string PROMPT.\n\
266 If optional second arg INITIAL-CONTENTS is non-nil, it is a string\n\ 291 If optional second arg INITIAL-CONTENTS is non-nil, it is a string\n\