0
|
1 /* Editor command loop.
|
|
2 Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995, 1996 Ben Wing.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Mule 2.0. Not synched with FSF.
|
|
23 This was renamed from keyboard.c. However, it only contains the
|
|
24 command-loop stuff from FSF's keyboard.c; all the rest is in
|
|
25 event*.c, console.c, or signal.c. */
|
|
26
|
|
27 /* #### This module purports to separate out the command-loop stuff
|
|
28 from event-stream.c, but it doesn't really. Perhaps this file
|
|
29 should just be merged into event-stream.c, given its shortness. */
|
|
30
|
|
31 #include <config.h>
|
|
32 #include "lisp.h"
|
|
33
|
|
34 #include "buffer.h"
|
|
35 #include "commands.h"
|
|
36 #include "frame.h"
|
|
37 #include "events.h"
|
|
38 #include "macros.h"
|
|
39 #include "window.h"
|
|
40
|
|
41 /* Current depth in recursive edits. */
|
|
42 int command_loop_level;
|
|
43
|
|
44 /* Total number of times command_loop has read a key sequence. */
|
|
45 int num_input_keys;
|
|
46
|
|
47 #ifndef LISP_COMMAND_LOOP
|
|
48 /* Form to evaluate (if non-nil) when Emacs is started. */
|
|
49 Lisp_Object Vtop_level;
|
|
50 #else
|
|
51 /* Function to call to evaluate to read and process events. */
|
|
52 Lisp_Object Vcommand_loop;
|
|
53 #endif /* LISP_COMMAND_LOOP */
|
|
54
|
|
55 Lisp_Object Venter_window_hook, Vleave_window_hook;
|
|
56
|
|
57 /* The error handler. */
|
|
58 Lisp_Object Qcommand_error;
|
|
59
|
|
60 /* The emergency error handler, before we're ready. */
|
|
61 Lisp_Object Qreally_early_error_handler;
|
|
62
|
|
63 static Lisp_Object command_loop_1 (Lisp_Object dummy);
|
|
64
|
|
65 /* There are two possible command loops -- one written entirely in
|
|
66 C and one written mostly in Lisp, except stuff written in C for
|
|
67 speed. The advantage of the Lisp command loop is that the user
|
|
68 can specify their own command loop to use by changing the variable
|
|
69 `command-loop'. Its disadvantage is that it's slow. */
|
|
70
|
|
71 static Lisp_Object
|
|
72 default_error_handler (Lisp_Object data)
|
|
73 {
|
|
74 int speccount = specpdl_depth ();
|
|
75
|
|
76 Fding (Qnil, Qnil, Qnil);
|
|
77 zmacs_deactivate_region ();
|
|
78 Fdiscard_input ();
|
|
79 specbind (Qinhibit_quit, Qt);
|
|
80 Vstandard_output = Qt;
|
|
81 Vstandard_input = Qt;
|
|
82 Vexecuting_macro = Qnil;
|
|
83 clear_echo_area (selected_frame (), Qnil, 0);
|
|
84 data = Fprin1_to_string (data, Qnil);
|
16
|
85 message ("Error: %s", XSTRING_DATA (data));
|
0
|
86 check_quit (); /* make Vquit_flag accurate */
|
|
87 Vquit_flag = Qnil;
|
|
88 return (unbind_to (speccount, Qt));
|
|
89 }
|
|
90
|
20
|
91 DEFUN ("really-early-error-handler", Freally_early_error_handler, 1, 1, 0, /*
|
0
|
92 You should almost certainly not be using this.
|
20
|
93 */
|
|
94 (x))
|
0
|
95 {
|
|
96 /* This is an error handler used when we're running temacs and when
|
|
97 we're in the early stages of XEmacs. No errors ought to be
|
|
98 occurring in those cases (or they ought to be trapped and
|
|
99 dealt with elsewhere), but if an error slips through, we need
|
|
100 to deal with it. We could write this function in Lisp (and it
|
|
101 used to be this way, at the beginning of loadup.el), but we do
|
|
102 it this way in case an error occurs before we get to loading
|
|
103 loadup.el. Note that there is also an `early-error-handler',
|
|
104 used in startup.el to catch more reasonable errors that
|
|
105 might occur during startup if the sysadmin or whoever fucked
|
|
106 up. This function is more conservative in what it does
|
|
107 and is used only as a last resort, indicating that the
|
|
108 programmer himself fucked up somewhere. */
|
|
109 stderr_out ("*** Error in XEmacs initialization");
|
|
110 Fprint (x, Qexternal_debugging_output);
|
|
111 stderr_out ("*** Backtrace\n");
|
|
112 Fbacktrace (Qexternal_debugging_output, Qt);
|
|
113 stderr_out ("*** Killing XEmacs\n");
|
|
114 return Fkill_emacs (make_int (-1));
|
|
115 }
|
|
116
|
|
117
|
|
118 /**********************************************************************/
|
|
119 /* Command-loop (in C) */
|
|
120 /**********************************************************************/
|
|
121
|
|
122 #ifndef LISP_COMMAND_LOOP
|
|
123
|
|
124 /* The guts of the command loop are in command_loop_1(). This function
|
|
125 doesn't catch errors, though -- that's the job of command_loop_2(),
|
|
126 which is a condition-case wrapper around command_loop_1().
|
|
127 command_loop_1() never returns, but may get thrown out of.
|
|
128
|
|
129 When an error occurs, cmd_error() is called, which usually
|
|
130 invokes the Lisp error handler in `command-error'; however,
|
|
131 a default error handler is provided if `command-error' is nil
|
|
132 (e.g. during startup). The purpose of the error handler is
|
|
133 simply to display the error message and do associated cleanup;
|
|
134 it does not need to throw anywhere. When the error handler
|
|
135 finishes, the condition-case in command_loop_2() will finish and
|
|
136 command_loop_2() will reinvoke command_loop_1().
|
|
137
|
|
138 command_loop_2() is invoked from three places: from
|
|
139 initial_command_loop() (called from main() at the end of
|
|
140 internal initialization), from the Lisp function `recursive-edit',
|
|
141 and from call_command_loop().
|
|
142
|
|
143 call_command_loop() is called when a macro is started and when the
|
|
144 minibuffer is entered; normal termination of the macro or
|
|
145 minibuffer causes a throw out of the recursive command loop. (To
|
|
146 'execute-kbd-macro for macros and 'exit for minibuffers. Note also
|
|
147 that the low-level minibuffer-entering function,
|
|
148 `read-minibuffer-internal', provides its own error handling and
|
|
149 does not need command_loop_2()'s error encapsulation; so it tells
|
|
150 call_command_loop() to invoke command_loop_1() directly.)
|
|
151
|
|
152 Note that both read-minibuffer-internal and recursive-edit set
|
|
153 up a catch for 'exit; this is why `abort-recursive-edit', which
|
|
154 throws to this catch, exits out of either one.
|
|
155
|
|
156 initial_command_loop(), called from main(), sets up a catch
|
|
157 for 'top-level when invoking command_loop_2(), allowing functions
|
|
158 to throw all the way to the top level if they really need to.
|
|
159 Before invoking command_loop_2(), initial_command_loop() calls
|
|
160 top_level_1(), which handles all of the startup stuff (creating
|
|
161 the initial frame, handling the command-line options, loading
|
|
162 the user's .emacs file, etc.). The function that actually does this
|
|
163 is in Lisp and is pointed to by the variable `top-level';
|
|
164 normally this function is `normal-top-level'. top_level_1() is
|
|
165 just an error-handling wrapper similar to command_loop_2().
|
|
166 Note also that initial_command_loop() sets up a catch for 'top-level
|
|
167 when invoking top_level_1(), just like when it invokes
|
|
168 command_loop_2(). */
|
|
169
|
|
170
|
|
171 static Lisp_Object
|
|
172 cmd_error (Lisp_Object data, Lisp_Object dummy)
|
|
173 {
|
|
174 /* This function can GC */
|
|
175 check_quit (); /* make Vquit_flag accurate */
|
|
176 Vquit_flag = Qnil;
|
|
177
|
|
178 any_console_state ();
|
|
179
|
|
180 if (!NILP (Ffboundp (Qcommand_error)))
|
|
181 return call1 (Qcommand_error, data);
|
|
182
|
|
183 return default_error_handler (data);
|
|
184 }
|
|
185
|
|
186 static Lisp_Object
|
|
187 top_level_1 (Lisp_Object dummy)
|
|
188 {
|
|
189 /* This function can GC */
|
|
190 /* On entry to the outer level, run the startup file */
|
|
191 if (!NILP (Vtop_level))
|
|
192 condition_case_1 (Qerror, Feval, Vtop_level, cmd_error, Qnil);
|
|
193 #if 1
|
|
194 else
|
|
195 {
|
|
196 message ("\ntemacs can only be run in -batch mode.");
|
|
197 noninteractive = 1; /* prevent things under kill-emacs from blowing up */
|
|
198 Fkill_emacs (make_int (-1));
|
|
199 }
|
|
200 #else
|
|
201 else if (purify_flag)
|
|
202 message ("Bare impure Emacs (standard Lisp code not loaded)");
|
|
203 else
|
|
204 message ("Bare Emacs (standard Lisp code not loaded)");
|
|
205 #endif
|
|
206
|
|
207 return Qnil;
|
|
208 }
|
|
209
|
|
210 /* Here we catch errors in execution of commands within the
|
|
211 editing loop, and reenter the editing loop.
|
|
212 When there is an error, cmd_error runs and the call
|
|
213 to condition_case_1() returns. */
|
|
214
|
|
215 /* Avoid confusing the compiler. A helper function for command_loop_2 */
|
|
216 static DOESNT_RETURN
|
|
217 command_loop_3 (void)
|
|
218 {
|
|
219 /* This function can GC */
|
|
220 for (;;)
|
|
221 {
|
|
222 condition_case_1 (Qerror, command_loop_1, Qnil, cmd_error, Qnil);
|
|
223 /* #### wrong with selected-console? */
|
|
224 /* See command in initial_command_loop about why this value
|
|
225 is 0. */
|
|
226 reset_this_command_keys (Vselected_console, 0);
|
|
227 }
|
|
228 }
|
|
229
|
|
230 static Lisp_Object
|
|
231 command_loop_2 (Lisp_Object dummy)
|
|
232 {
|
|
233 command_loop_3(); /* doesn't return */
|
|
234 return Qnil;
|
|
235 }
|
|
236
|
|
237 /* This is called from emacs.c when it's done with initialization. */
|
|
238
|
|
239 DOESNT_RETURN
|
|
240 initial_command_loop (Lisp_Object load_me)
|
|
241 {
|
|
242 /* This function can GC */
|
|
243 if (!NILP (load_me))
|
|
244 Vtop_level = list2 (Qload, load_me);
|
|
245
|
|
246 /* First deal with startup and command-line arguments. A throw
|
|
247 to 'top-level gets us back here directly (does this ever happen?).
|
|
248 Otherwise, this function will return normally when all command-
|
|
249 line arguments have been processed, the user's initialization
|
|
250 file has been read in, and the first frame has been created. */
|
|
251 internal_catch (Qtop_level, top_level_1, Qnil, 0);
|
|
252
|
|
253 /* If an error occurred during startup and the initial console
|
|
254 wasn't created, then die now (the error was already printed out
|
|
255 on the terminal device). */
|
|
256 if (!noninteractive &&
|
|
257 (!CONSOLEP (Vselected_console) ||
|
|
258 CONSOLE_STREAM_P (XCONSOLE (Vselected_console))))
|
|
259 Fkill_emacs (make_int (-1));
|
|
260
|
|
261 /* End of -batch run causes exit here. */
|
|
262 if (noninteractive)
|
|
263 Fkill_emacs (Qt);
|
|
264
|
|
265 for (;;)
|
|
266 {
|
|
267 command_loop_level = 0;
|
|
268 MARK_MODELINE_CHANGED;
|
|
269 /* Now invoke the command loop. It never returns; however, a
|
|
270 throw to 'top-level will place us at the end of this loop. */
|
|
271 internal_catch (Qtop_level, command_loop_2, Qnil, 0);
|
|
272 /* #### wrong with selected-console? */
|
|
273 /* We don't actually call clear_echo_area() here, partially
|
|
274 at least because that runs Lisp code and it may be unsafe
|
|
275 to do so -- we are outside of the normal catches for
|
|
276 errors and such. */
|
|
277 reset_this_command_keys (Vselected_console, 0);
|
|
278 }
|
|
279 }
|
|
280
|
|
281 /* This function is invoked when a macro or minibuffer starts up.
|
|
282 Normal termination of the macro or minibuffer causes a throw past us.
|
|
283 See the comment above.
|
|
284
|
|
285 Note that this function never returns (but may be thrown out of). */
|
|
286
|
|
287 Lisp_Object
|
|
288 call_command_loop (Lisp_Object catch_errors)
|
|
289 {
|
|
290 /* This function can GC */
|
|
291 if (NILP (catch_errors))
|
|
292 return (command_loop_1 (Qnil));
|
|
293 else
|
|
294 return (command_loop_2 (Qnil));
|
|
295 }
|
|
296
|
|
297 static Lisp_Object
|
|
298 recursive_edit_unwind (Lisp_Object buffer)
|
|
299 {
|
|
300 if (!NILP (buffer))
|
|
301 Fset_buffer (buffer);
|
|
302
|
|
303 command_loop_level--;
|
|
304 MARK_MODELINE_CHANGED;
|
|
305
|
|
306 return Qnil;
|
|
307 }
|
|
308
|
20
|
309 DEFUN ("recursive-edit", Frecursive_edit, 0, 0, "", /*
|
0
|
310 Invoke the editor command loop recursively.
|
|
311 To get out of the recursive edit, a command can do `(throw 'exit nil)';
|
|
312 that tells this function to return.
|
|
313 Alternately, `(throw 'exit t)' makes this function signal an error.
|
20
|
314 */
|
|
315 ())
|
0
|
316 {
|
|
317 /* This function can GC */
|
|
318 Lisp_Object val;
|
|
319 int speccount = specpdl_depth ();
|
|
320
|
|
321 command_loop_level++;
|
|
322 MARK_MODELINE_CHANGED;
|
|
323
|
|
324 record_unwind_protect (recursive_edit_unwind,
|
|
325 ((current_buffer
|
|
326 != XBUFFER (XWINDOW (Fselected_window
|
|
327 (Qnil))->buffer))
|
|
328 ? Fcurrent_buffer ()
|
|
329 : Qnil));
|
|
330
|
|
331 specbind (Qstandard_output, Qt);
|
|
332 specbind (Qstandard_input, Qt);
|
|
333
|
|
334 val = internal_catch (Qexit, command_loop_2, Qnil, 0);
|
|
335
|
|
336 if (EQ (val, Qt))
|
|
337 /* Turn abort-recursive-edit into a quit. */
|
|
338 Fsignal (Qquit, Qnil);
|
|
339
|
|
340 return unbind_to (speccount, Qnil);
|
|
341 }
|
|
342
|
|
343 #endif /* !LISP_COMMAND_LOOP */
|
|
344
|
|
345
|
|
346 /**********************************************************************/
|
|
347 /* Alternate command-loop (largely in Lisp) */
|
|
348 /**********************************************************************/
|
|
349
|
|
350 #ifdef LISP_COMMAND_LOOP
|
|
351
|
|
352 static Lisp_Object
|
|
353 load1 (Lisp_Object name)
|
|
354 {
|
|
355 /* This function can GC */
|
|
356 call4 (Qload, name, Qnil, Qt, Qnil);
|
|
357 return (Qnil);
|
|
358 }
|
|
359
|
|
360 /* emergency backups for cold-load-stream use */
|
|
361 static Lisp_Object
|
|
362 cold_load_command_error (Lisp_Object datum, Lisp_Object ignored)
|
|
363 {
|
|
364 /* This function can GC */
|
|
365 check_quit (); /* make Vquit_flag accurate */
|
|
366 Vquit_flag = Qnil;
|
|
367
|
|
368 return default_error_handler (datum);
|
|
369 }
|
|
370
|
|
371 static Lisp_Object
|
|
372 cold_load_command_loop (Lisp_Object dummy)
|
|
373 {
|
|
374 /* This function can GC */
|
|
375 return (condition_case_1 (Qt,
|
|
376 command_loop_1, Qnil,
|
|
377 cold_load_command_error, Qnil));
|
|
378 }
|
|
379
|
|
380 Lisp_Object
|
|
381 call_command_loop (Lisp_Object catch_errors)
|
|
382 {
|
|
383 /* This function can GC */
|
|
384 reset_this_command_keys (Vselected_console, Qnil); /* #### bleagh */
|
|
385
|
|
386 loop:
|
|
387 for (;;)
|
|
388 {
|
|
389 if (NILP (Vcommand_loop))
|
|
390 break;
|
|
391 call1 (Vcommand_loop, catch_errors);
|
|
392 }
|
|
393
|
|
394 /* This isn't a "correct" definition, but you're pretty hosed if
|
|
395 you broke "command-loop" anyway */
|
|
396 /* #### not correct with Vselected_console */
|
|
397 XCONSOLE (Vselected_console)->prefix_arg = Qnil;
|
|
398 if (NILP (catch_errors))
|
|
399 Fcommand_loop_1 ();
|
|
400 else
|
|
401 internal_catch (Qtop_level,
|
|
402 cold_load_command_loop, Qnil, 0);
|
|
403 goto loop;
|
|
404 return Qnil;
|
|
405 }
|
|
406
|
|
407 static Lisp_Object
|
|
408 initial_error_handler (Lisp_Object datum, Lisp_Object ignored)
|
|
409 {
|
|
410 /* This function can GC */
|
|
411 Vcommand_loop = Qnil;
|
|
412 Fding (Qnil, Qnil, Qnil);
|
|
413
|
|
414 if (CONSP (datum) && EQ (XCAR (datum), Qquit))
|
|
415 /* Don't bother with the message */
|
|
416 return (Qt);
|
|
417
|
|
418 message ("Error in command-loop!!");
|
|
419 Fset (intern ("last-error"), datum); /* #### Better/different name? */
|
|
420 Fsit_for (make_int (2), Qnil);
|
|
421 cold_load_command_error (datum, Qnil);
|
|
422 return (Qt);
|
|
423 }
|
|
424
|
|
425 DOESNT_RETURN
|
|
426 initial_command_loop (Lisp_Object load_me)
|
|
427 {
|
|
428 /* This function can GC */
|
|
429 if (!NILP (load_me))
|
|
430 {
|
|
431 if (!NILP (condition_case_1 (Qt, load1, load_me,
|
|
432 initial_error_handler, Qnil)))
|
|
433 Fkill_emacs (make_int (-1));
|
|
434 }
|
|
435
|
|
436 for (;;)
|
|
437 {
|
|
438 command_loop_level = 0;
|
|
439 MARK_MODELINE_CHANGED;
|
|
440
|
|
441 condition_case_1 (Qt,
|
|
442 call_command_loop, Qtop_level,
|
|
443 initial_error_handler, Qnil);
|
|
444 }
|
|
445 }
|
|
446
|
|
447 #endif /* LISP_COMMAND_LOOP */
|
|
448
|
|
449
|
|
450 /**********************************************************************/
|
|
451 /* Guts of command loop */
|
|
452 /**********************************************************************/
|
|
453
|
|
454 static Lisp_Object
|
|
455 command_loop_1 (Lisp_Object dummy)
|
|
456 {
|
|
457 /* This function can GC */
|
|
458 /* #### not correct with Vselected_console */
|
|
459 XCONSOLE (Vselected_console)->prefix_arg = Qnil;
|
|
460 return (Fcommand_loop_1 ());
|
|
461 }
|
|
462
|
|
463 /* This is the actual command reading loop, sans error-handling
|
|
464 encapsulation. This is used for both the C and Lisp command
|
|
465 loops. Originally this function was written in Lisp when
|
|
466 the Lisp command loop was used, but it was too slow that way.
|
|
467
|
|
468 Under the C command loop, this function will never return
|
|
469 (although someone might throw past it). Under the Lisp
|
|
470 command loop, this will return only when the user specifies
|
|
471 a new command loop by changing the command-loop variable. */
|
|
472
|
20
|
473 DEFUN ("command-loop-1", Fcommand_loop_1, 0, 0, 0, /*
|
0
|
474 Invoke the internals of the canonical editor command loop.
|
|
475 Don't call this unless you know what you're doing.
|
20
|
476 */
|
|
477 ())
|
0
|
478 {
|
|
479 /* This function can GC */
|
|
480 Lisp_Object event = Fmake_event ();
|
|
481 Lisp_Object old_loop = Qnil;
|
|
482 struct gcpro gcpro1, gcpro2;
|
|
483 int was_locked = in_single_console_state ();
|
|
484 GCPRO2 (event, old_loop);
|
|
485
|
|
486 /* cancel_echoing (); */
|
|
487 /* This magically makes single character keyboard macros work just
|
|
488 like the real thing. This is slightly bogus, but it's in here for
|
|
489 compatibility with Emacs 18. It's not even clear what the "right
|
|
490 thing" is. */
|
|
491 if (!(((STRINGP (Vexecuting_macro) || VECTORP (Vexecuting_macro))
|
|
492 && XINT (Flength (Vexecuting_macro)) == 1)))
|
|
493 Vlast_command = Qt;
|
|
494
|
|
495 #ifndef LISP_COMMAND_LOOP
|
|
496 while (1)
|
|
497 #else
|
|
498 old_loop = Vcommand_loop;
|
|
499 while (EQ (Vcommand_loop, old_loop))
|
|
500 #endif /* LISP_COMMAND_LOOP */
|
|
501 {
|
|
502 /* Make sure the current window's buffer is selected. */
|
|
503 {
|
|
504 Lisp_Object selected_window = Fselected_window (Qnil);
|
|
505
|
|
506 if (!NILP (selected_window) &&
|
|
507 (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer))
|
|
508 {
|
|
509 set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
|
|
510 }
|
|
511 }
|
|
512
|
|
513 /* If ^G was typed before we got here (that is, before emacs was
|
|
514 idle and waiting for input) then we treat that as an interrupt. */
|
|
515 QUIT;
|
|
516
|
|
517 /* If minibuffer on and echo area in use, wait 2 sec and redraw
|
|
518 minibuffer. Treat a ^G here as a command, not an interrupt.
|
|
519 */
|
|
520 if (minibuf_level > 0 && echo_area_active (selected_frame ()))
|
|
521 {
|
|
522 /* Bind dont_check_for_quit to 1 so that C-g gets read in
|
|
523 rather than quitting back to the minibuffer. */
|
|
524 int count = specpdl_depth ();
|
|
525 begin_dont_check_for_quit ();
|
|
526 Fsit_for (make_int (2), Qnil);
|
|
527 clear_echo_area (selected_frame (), Qnil, 0);
|
|
528 unbind_to (count, Qnil);
|
|
529 }
|
|
530
|
|
531 Fnext_event (event, Qnil);
|
|
532 /* If ^G was typed while emacs was reading input from the user, then
|
|
533 Fnext_event() will have read it as a normal event and
|
|
534 next_event_internal() will have set Vquit_flag. We reset this
|
|
535 so that the ^G is treated as just another key. This is strange,
|
|
536 but it is what emacs 18 did.
|
|
537
|
|
538 Do not call check_quit() here. */
|
|
539 Vquit_flag = Qnil;
|
|
540 Fdispatch_event (event);
|
|
541
|
|
542 if (!was_locked)
|
|
543 any_console_state ();
|
|
544 #if defined (__SUNPRO_C) || (defined (DEC_ALPHA) && defined (OSF1))
|
|
545 if (0) return Qnil; /* Shut up compiler */
|
|
546 #endif
|
|
547 }
|
|
548 #ifdef LISP_COMMAND_LOOP
|
|
549 UNGCPRO;
|
|
550 return Qnil;
|
|
551 #endif
|
|
552 }
|
|
553
|
|
554
|
|
555 /**********************************************************************/
|
|
556 /* Initialization */
|
|
557 /**********************************************************************/
|
|
558
|
|
559 void
|
|
560 syms_of_cmdloop (void)
|
|
561 {
|
|
562 defsymbol (&Qcommand_error, "command-error");
|
|
563 defsymbol (&Qreally_early_error_handler, "really-early-error-handler");
|
|
564 defsymbol (&Qtop_level, "top-level");
|
|
565
|
|
566 #ifndef LISP_COMMAND_LOOP
|
20
|
567 DEFSUBR (Frecursive_edit);
|
0
|
568 #endif
|
20
|
569 DEFSUBR (Freally_early_error_handler);
|
|
570 DEFSUBR (Fcommand_loop_1);
|
0
|
571 }
|
|
572
|
|
573 void
|
|
574 vars_of_cmdloop (void)
|
|
575 {
|
|
576 DEFVAR_INT ("command-loop-level", &command_loop_level /*
|
|
577 Number of recursive edits in progress.
|
|
578 */ );
|
|
579 command_loop_level = 0;
|
|
580
|
|
581 DEFVAR_LISP ("disabled-command-hook", &Vdisabled_command_hook /*
|
|
582 Value is called instead of any command that is disabled,
|
|
583 i.e. has a non-nil `disabled' property.
|
|
584 */ );
|
|
585 Vdisabled_command_hook = intern ("disabled-command-hook");
|
|
586
|
|
587 DEFVAR_LISP ("leave-window-hook", &Vleave_window_hook /*
|
|
588 Not yet implemented.
|
|
589 */ );
|
|
590 Vleave_window_hook = Qnil;
|
|
591
|
|
592 DEFVAR_LISP ("enter-window-hook", &Venter_window_hook /*
|
|
593 Not yet implemented.
|
|
594 */ );
|
|
595 Venter_window_hook = Qnil;
|
|
596
|
|
597 #ifndef LISP_COMMAND_LOOP
|
|
598 DEFVAR_LISP ("top-level", &Vtop_level /*
|
|
599 Form to evaluate when Emacs starts up.
|
|
600 Useful to set before you dump a modified Emacs.
|
|
601 */ );
|
|
602 Vtop_level = Qnil;
|
|
603 #else
|
|
604 DEFVAR_LISP ("command-loop", &Vcommand_loop /*
|
|
605 Function or one argument to call to read and process keyboard commands.
|
|
606 The passed argument specifies whether or not to handle errors.
|
|
607 */ );
|
|
608 Vcommand_loop = Qnil;
|
|
609 #endif /* LISP_COMMAND_LOOP */
|
|
610 }
|