comparison src/macros.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 376386a54a3c
children 8eaf7971accc
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
47 */ 47 */
48 Lisp_Object Vexecuting_macro; 48 Lisp_Object Vexecuting_macro;
49 int executing_macro_index; 49 int executing_macro_index;
50 50
51 51
52 DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 1, "P" /* 52 DEFUN ("start-kbd-macro", Fstart_kbd_macro, 1, 1, "P", /*
53 Record subsequent keyboard and menu input, defining a keyboard macro. 53 Record subsequent keyboard and menu input, defining a keyboard macro.
54 The commands are recorded even as they are executed. 54 The commands are recorded even as they are executed.
55 Use \\[end-kbd-macro] to finish recording and make the macro available. 55 Use \\[end-kbd-macro] to finish recording and make the macro available.
56 Use \\[name-last-kbd-macro] to give it a permanent name. 56 Use \\[name-last-kbd-macro] to give it a permanent name.
57 Non-nil arg (prefix arg) means append to last macro defined; 57 Non-nil arg (prefix arg) means append to last macro defined;
58 This begins by re-executing that macro as if you typed it again. 58 This begins by re-executing that macro as if you typed it again.
59 */ ) 59 */
60 (append) 60 (append))
61 Lisp_Object append;
62 { 61 {
63 /* This function can GC */ 62 /* This function can GC */
64 struct console *con = XCONSOLE (Vselected_console); 63 struct console *con = XCONSOLE (Vselected_console);
65 if (!NILP (con->defining_kbd_macro)) 64 if (!NILP (con->defining_kbd_macro))
66 error ("Already defining kbd macro"); 65 error ("Already defining kbd macro");
86 con->defining_kbd_macro = Qt; 85 con->defining_kbd_macro = Qt;
87 86
88 return Qnil; 87 return Qnil;
89 } 88 }
90 89
91 DEFUN ("end-kbd-macro", Fend_kbd_macro, Send_kbd_macro, 0, 1, "P" /* 90 DEFUN ("end-kbd-macro", Fend_kbd_macro, 0, 1, "P", /*
92 Finish defining a keyboard macro. 91 Finish defining a keyboard macro.
93 The definition was started by \\[start-kbd-macro]. 92 The definition was started by \\[start-kbd-macro].
94 The macro is now available for use via \\[call-last-kbd-macro], 93 The macro is now available for use via \\[call-last-kbd-macro],
95 or it can be given a name with \\[name-last-kbd-macro] and then invoked 94 or it can be given a name with \\[name-last-kbd-macro] and then invoked
96 under that name. 95 under that name.
97 96
98 With numeric arg, repeat macro now that many times, 97 With numeric arg, repeat macro now that many times,
99 counting the definition just completed as the first repetition. 98 counting the definition just completed as the first repetition.
100 An argument of zero means repeat until error. 99 An argument of zero means repeat until error.
101 */ ) 100 */
102 (arg) 101 (arg))
103 Lisp_Object arg;
104 { 102 {
105 /* This function can GC */ 103 /* This function can GC */
106 struct console *con = XCONSOLE (Vselected_console); 104 struct console *con = XCONSOLE (Vselected_console);
107 int repeat; 105 int repeat;
108 106
194 finalize_kbd_macro_chars (struct console *con) 192 finalize_kbd_macro_chars (struct console *con)
195 { 193 {
196 con->kbd_macro_end = con->kbd_macro_ptr; 194 con->kbd_macro_end = con->kbd_macro_ptr;
197 } 195 }
198 196
199 DEFUN ("cancel-kbd-macro-events", Fcancel_kbd_macro_events, 197 DEFUN ("cancel-kbd-macro-events", Fcancel_kbd_macro_events, 0, 0, 0, /*
200 Scancel_kbd_macro_events, 0, 0, 0 /*
201 Cancel the events added to a keyboard macro for this command. 198 Cancel the events added to a keyboard macro for this command.
202 */ ) 199 */
203 () 200 ())
204 { 201 {
205 struct console *con = XCONSOLE (Vselected_console); 202 struct console *con = XCONSOLE (Vselected_console);
206 203
207 con->kbd_macro_ptr = con->kbd_macro_end; 204 con->kbd_macro_ptr = con->kbd_macro_end;
208 205
209 return Qnil; 206 return Qnil;
210 } 207 }
211 208
212 DEFUN ("call-last-kbd-macro", Fcall_last_kbd_macro, Scall_last_kbd_macro, 209 DEFUN ("call-last-kbd-macro", Fcall_last_kbd_macro, 0, 1, "p", /*
213 0, 1, "p" /*
214 Call the last keyboard macro that you defined with \\[start-kbd-macro]. 210 Call the last keyboard macro that you defined with \\[start-kbd-macro].
215 211
216 A prefix argument serves as a repeat count. Zero means repeat until error. 212 A prefix argument serves as a repeat count. Zero means repeat until error.
217 213
218 To make a macro permanent so you can call it even after 214 To make a macro permanent so you can call it even after
219 defining others, use \\[name-last-kbd-macro]. 215 defining others, use \\[name-last-kbd-macro].
220 */ ) 216 */
221 (prefix) 217 (prefix))
222 Lisp_Object prefix;
223 { 218 {
224 /* This function can GC */ 219 /* This function can GC */
225 struct console *con = XCONSOLE (Vselected_console); 220 struct console *con = XCONSOLE (Vselected_console);
226 221
227 if (!NILP (con->defining_kbd_macro)) 222 if (!NILP (con->defining_kbd_macro))
243 tem = Fcdr (info); 238 tem = Fcdr (info);
244 executing_macro_index = XINT (tem); 239 executing_macro_index = XINT (tem);
245 return Qnil; 240 return Qnil;
246 } 241 }
247 242
248 DEFUN ("execute-kbd-macro", Fexecute_kbd_macro, Sexecute_kbd_macro, 1, 2, 0 /* 243 DEFUN ("execute-kbd-macro", Fexecute_kbd_macro, 1, 2, 0, /*
249 Execute MACRO as string of editor command characters. 244 Execute MACRO as string of editor command characters.
250 If MACRO is a symbol, its function definition is used. 245 If MACRO is a symbol, its function definition is used.
251 COUNT is a repeat count, or nil for once, or 0 for infinite loop. 246 COUNT is a repeat count, or nil for once, or 0 for infinite loop.
252 */ ) 247 */
253 (macro, prefixarg) 248 (macro, prefixarg))
254 Lisp_Object macro, prefixarg;
255 { 249 {
256 /* This function can GC */ 250 /* This function can GC */
257 Lisp_Object final; 251 Lisp_Object final;
258 Lisp_Object tem; 252 Lisp_Object tem;
259 int speccount = specpdl_depth (); 253 int speccount = specpdl_depth ();
293 287
294 288
295 void 289 void
296 syms_of_macros (void) 290 syms_of_macros (void)
297 { 291 {
298 defsubr (&Sstart_kbd_macro); 292 DEFSUBR (Fstart_kbd_macro);
299 defsubr (&Send_kbd_macro); 293 DEFSUBR (Fend_kbd_macro);
300 defsubr (&Scall_last_kbd_macro); 294 DEFSUBR (Fcall_last_kbd_macro);
301 defsubr (&Sexecute_kbd_macro); 295 DEFSUBR (Fexecute_kbd_macro);
302 defsubr (&Scancel_kbd_macro_events); 296 DEFSUBR (Fcancel_kbd_macro_events);
303 defsymbol (&Qexecute_kbd_macro, "execute-kbd-macro"); 297 defsymbol (&Qexecute_kbd_macro, "execute-kbd-macro");
304 } 298 }
305 299
306 void 300 void
307 vars_of_macros (void) 301 vars_of_macros (void)