annotate src/cmdloop.c @ 408:501cfd01ee6d r21-2-34

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