diff options
| author | Richard M. Stallman | 1996-08-29 04:38:05 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-08-29 04:38:05 +0000 |
| commit | d4087e062b692c7301fd932e835aa55d527bce49 (patch) | |
| tree | be8d532b22985e1e02ec8d733111b753fd4d793b /src | |
| parent | 77aa8edfb641b58ed7e10f1484f32a78dab49f76 (diff) | |
| download | emacs-d4087e062b692c7301fd932e835aa55d527bce49.tar.gz emacs-d4087e062b692c7301fd932e835aa55d527bce49.zip | |
(executing_macro_iterations, executing_macro): New vars.
(Fexecute_kbd_macro): Set them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/macros.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/macros.c b/src/macros.c index 2b413d6d7d4..2592faeba19 100644 --- a/src/macros.c +++ b/src/macros.c | |||
| @@ -29,9 +29,28 @@ Boston, MA 02111-1307, USA. */ | |||
| 29 | 29 | ||
| 30 | Lisp_Object Qexecute_kbd_macro; | 30 | Lisp_Object Qexecute_kbd_macro; |
| 31 | 31 | ||
| 32 | /* Kbd macro currently being executed (a string or vector). */ | ||
| 33 | |||
| 32 | Lisp_Object Vexecuting_macro; | 34 | Lisp_Object Vexecuting_macro; |
| 35 | |||
| 36 | /* Index of next character to fetch from that macro. */ | ||
| 37 | |||
| 33 | int executing_macro_index; | 38 | int executing_macro_index; |
| 34 | 39 | ||
| 40 | /* Number of successful iterations so far | ||
| 41 | for innermost keyboard macro. | ||
| 42 | This is not bound at each level, | ||
| 43 | so after an error, it describes the innermost interrupted macro. */ | ||
| 44 | |||
| 45 | int executing_macro_iterations; | ||
| 46 | |||
| 47 | /* This is the macro that was executing. | ||
| 48 | This is not bound at each level, | ||
| 49 | so after an error, it describes the innermost interrupted macro. | ||
| 50 | We use it only as a kind of flag, so no need to protect it. */ | ||
| 51 | |||
| 52 | Lisp_Object executing_macro; | ||
| 53 | |||
| 35 | Lisp_Object Fexecute_kbd_macro (); | 54 | Lisp_Object Fexecute_kbd_macro (); |
| 36 | 55 | ||
| 37 | DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 1, "P", | 56 | DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 1, "P", |
| @@ -196,6 +215,7 @@ defining others, use \\[name-last-kbd-macro].") | |||
| 196 | 215 | ||
| 197 | /* Restore Vexecuting_macro and executing_macro_index - called when | 216 | /* Restore Vexecuting_macro and executing_macro_index - called when |
| 198 | the unwind-protect in Fexecute_kbd_macro gets invoked. */ | 217 | the unwind-protect in Fexecute_kbd_macro gets invoked. */ |
| 218 | |||
| 199 | static Lisp_Object | 219 | static Lisp_Object |
| 200 | pop_kbd_macro (info) | 220 | pop_kbd_macro (info) |
| 201 | Lisp_Object info; | 221 | Lisp_Object info; |
| @@ -219,6 +239,7 @@ COUNT is a repeat count, or nil for once, or 0 for infinite loop.") | |||
| 219 | int pdlcount = specpdl_ptr - specpdl; | 239 | int pdlcount = specpdl_ptr - specpdl; |
| 220 | int repeat = 1; | 240 | int repeat = 1; |
| 221 | struct gcpro gcpro1; | 241 | struct gcpro gcpro1; |
| 242 | int success_count = 0; | ||
| 222 | 243 | ||
| 223 | if (!NILP (count)) | 244 | if (!NILP (count)) |
| 224 | { | 245 | { |
| @@ -238,16 +259,21 @@ COUNT is a repeat count, or nil for once, or 0 for infinite loop.") | |||
| 238 | do | 259 | do |
| 239 | { | 260 | { |
| 240 | Vexecuting_macro = final; | 261 | Vexecuting_macro = final; |
| 262 | executing_macro = final; | ||
| 241 | executing_macro_index = 0; | 263 | executing_macro_index = 0; |
| 242 | 264 | ||
| 243 | current_kboard->Vprefix_arg = Qnil; | 265 | current_kboard->Vprefix_arg = Qnil; |
| 244 | command_loop_1 (); | 266 | command_loop_1 (); |
| 245 | 267 | ||
| 268 | executing_macro_iterations = ++success_count; | ||
| 269 | |||
| 246 | QUIT; | 270 | QUIT; |
| 247 | } | 271 | } |
| 248 | while (--repeat | 272 | while (--repeat |
| 249 | && (STRINGP (Vexecuting_macro) || VECTORP (Vexecuting_macro))); | 273 | && (STRINGP (Vexecuting_macro) || VECTORP (Vexecuting_macro))); |
| 250 | 274 | ||
| 275 | executing_macro = Qnil; | ||
| 276 | |||
| 251 | UNGCPRO; | 277 | UNGCPRO; |
| 252 | return unbind_to (pdlcount, Qnil); | 278 | return unbind_to (pdlcount, Qnil); |
| 253 | } | 279 | } |