/[emacs]/emacs/src/macros.c
ViewVC logotype

Diff of /emacs/src/macros.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.56 by rms, Sun May 1 18:48:26 2005 UTC revision 1.57 by kfstorm, Mon May 2 10:32:40 2005 UTC
# Line 35  Lisp_Object Vexecuting_kbd_macro; Line 35  Lisp_Object Vexecuting_kbd_macro;
35    
36  /* Index of next character to fetch from that macro.  */  /* Index of next character to fetch from that macro.  */
37    
38  EMACS_INT executing_macro_index;  EMACS_INT executing_kbd_macro_index;
39    
40  /* Number of successful iterations so far  /* Number of successful iterations so far
41     for innermost keyboard macro.     for innermost keyboard macro.
42     This is not bound at each level,     This is not bound at each level,
43     so after an error, it describes the innermost interrupted macro.  */     so after an error, it describes the innermost interrupted macro.  */
44    
45  int executing_macro_iterations;  int executing_kbd_macro_iterations;
46    
47  /* This is the macro that was executing.  /* This is the macro that was executing.
48     This is not bound at each level,     This is not bound at each level,
49     so after an error, it describes the innermost interrupted macro.     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.  */     We use it only as a kind of flag, so no need to protect it.  */
51    
52  Lisp_Object executing_macro;  Lisp_Object executing_kbd_macro;
53    
54  extern Lisp_Object real_this_command;  extern Lisp_Object real_this_command;
55    
# Line 114  macro before appending to it. */) Line 114  macro before appending to it. */)
114          }          }
115    
116        /* Must convert meta modifier when copying string to vector.  */        /* Must convert meta modifier when copying string to vector.  */
117        cvt = STRINGP (current_kboard->Vlast_kbd_macro);        cvt = STRINGP (current_kboard->Vlast_kbd_macro);
118        for (i = 0; i < len; i++)        for (i = 0; i < len; i++)
119          {          {
120            Lisp_Object c;            Lisp_Object c;
# Line 285  each iteration of the macro.  Iteration Line 285  each iteration of the macro.  Iteration
285    return Qnil;    return Qnil;
286  }  }
287    
288  /* Restore Vexecuting_kbd_macro and executing_macro_index - called when  /* Restore Vexecuting_kbd_macro and executing_kbd_macro_index.
289     the unwind-protect in Fexecute_kbd_macro gets invoked.  */     Called when the unwind-protect in Fexecute_kbd_macro gets invoked.  */
290    
291  static Lisp_Object  static Lisp_Object
292  pop_kbd_macro (info)  pop_kbd_macro (info)
# Line 295  pop_kbd_macro (info) Line 295  pop_kbd_macro (info)
295    Lisp_Object tem;    Lisp_Object tem;
296    Vexecuting_kbd_macro = XCAR (info);    Vexecuting_kbd_macro = XCAR (info);
297    tem = XCDR (info);    tem = XCDR (info);
298    executing_macro_index = XINT (XCAR (tem));    executing_kbd_macro_index = XINT (XCAR (tem));
299    real_this_command = XCDR (tem);    real_this_command = XCDR (tem);
300    Frun_hooks (1, &Qkbd_macro_termination_hook);    Frun_hooks (1, &Qkbd_macro_termination_hook);
301    return Qnil;    return Qnil;
# Line 318  each iteration of the macro.  Iteration Line 318  each iteration of the macro.  Iteration
318    struct gcpro gcpro1, gcpro2;    struct gcpro gcpro1, gcpro2;
319    int success_count = 0;    int success_count = 0;
320    
321    executing_macro_iterations = 0;    executing_kbd_macro_iterations = 0;
322    
323    if (!NILP (count))    if (!NILP (count))
324      {      {
# Line 331  each iteration of the macro.  Iteration Line 331  each iteration of the macro.  Iteration
331      error ("Keyboard macros must be strings or vectors");      error ("Keyboard macros must be strings or vectors");
332    
333    tem = Fcons (Vexecuting_kbd_macro,    tem = Fcons (Vexecuting_kbd_macro,
334                 Fcons (make_number (executing_macro_index),                 Fcons (make_number (executing_kbd_macro_index),
335                        real_this_command));                        real_this_command));
336    record_unwind_protect (pop_kbd_macro, tem);    record_unwind_protect (pop_kbd_macro, tem);
337    
# Line 339  each iteration of the macro.  Iteration Line 339  each iteration of the macro.  Iteration
339    do    do
340      {      {
341        Vexecuting_kbd_macro = final;        Vexecuting_kbd_macro = final;
342        executing_macro = final;        executing_kbd_macro = final;
343        executing_macro_index = 0;        executing_kbd_macro_index = 0;
344    
345        current_kboard->Vprefix_arg = Qnil;        current_kboard->Vprefix_arg = Qnil;
346    
# Line 354  each iteration of the macro.  Iteration Line 354  each iteration of the macro.  Iteration
354    
355        command_loop_1 ();        command_loop_1 ();
356    
357        executing_macro_iterations = ++success_count;        executing_kbd_macro_iterations = ++success_count;
358    
359        QUIT;        QUIT;
360      }      }
361    while (--repeat    while (--repeat
362           && (STRINGP (Vexecuting_kbd_macro) || VECTORP (Vexecuting_kbd_macro)));           && (STRINGP (Vexecuting_kbd_macro) || VECTORP (Vexecuting_kbd_macro)));
363    
364    executing_macro = Qnil;    executing_kbd_macro = Qnil;
365    
366    real_this_command = Vexecuting_kbd_macro;    real_this_command = Vexecuting_kbd_macro;
367    
# Line 373  void Line 373  void
373  init_macros ()  init_macros ()
374  {  {
375    Vexecuting_kbd_macro = Qnil;    Vexecuting_kbd_macro = Qnil;
376    executing_macro = Qnil;    executing_kbd_macro = Qnil;
377  }  }
378    
379  void  void
# Line 400  an existing macro.  */); Line 400  an existing macro.  */);
400                 doc: /* Currently executing keyboard macro (string or vector).                 doc: /* Currently executing keyboard macro (string or vector).
401  This is nil when not executing a keyboard macro.  */);  This is nil when not executing a keyboard macro.  */);
402    
403    DEFVAR_INT ("executing-macro-index", &executing_macro_index,    DEFVAR_INT ("executing-kbd-macro-index", &executing_kbd_macro_index,
404                doc: /* Index in currently executing keyboard macro; undefined if none executing.  */);                doc: /* Index in currently executing keyboard macro; undefined if none executing.  */);
405    
406    DEFVAR_KBOARD ("last-kbd-macro", Vlast_kbd_macro,    DEFVAR_KBOARD ("last-kbd-macro", Vlast_kbd_macro,

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26