]> code.delx.au - gnu-emacs/blobdiff - src/macros.c
* xterm.c (XTread_socket): Turn off ControlMask for XLookupString.
[gnu-emacs] / src / macros.c
index 5b19d926d6611a2f4dcc1e0e6af239334b9d0776..71ecb86cf6c43b789c9dadaca3e2434530f6d2f2 100644 (file)
@@ -1,11 +1,11 @@
 /* Keyboard macros.
-   Copyright (C) 1985, 1986 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
+the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -64,7 +64,7 @@ Non-nil arg (prefix arg) means append to last macro defined;\n\
     error ("Already defining kbd macro");
 
   update_mode_lines++;
-  if (NULL (append))
+  if (NILP (append))
     {
       kbd_macro_ptr = kbd_macro_buffer;
       kbd_macro_end = kbd_macro_buffer;
@@ -97,7 +97,7 @@ An argument of zero means repeat until error.")
   if (!defining_kbd_macro)
       error ("Not defining kbd macro.");
 
-  if (NULL (arg))
+  if (NILP (arg))
     XFASTINT (arg) = 1;
   else
     CHECK_NUMBER (arg, 0);
@@ -106,8 +106,8 @@ An argument of zero means repeat until error.")
     {
       defining_kbd_macro = 0;
       update_mode_lines++;
-      Vlast_kbd_macro = make_array (kbd_macro_end - kbd_macro_buffer,
-                                   kbd_macro_buffer);
+      Vlast_kbd_macro = make_event_array (kbd_macro_end - kbd_macro_buffer,
+                                         kbd_macro_buffer);
       message("Keyboard macro defined");
     }
 
@@ -115,8 +115,8 @@ An argument of zero means repeat until error.")
     Fexecute_kbd_macro (Vlast_kbd_macro, arg);
   else
     {
-      XFASTINT (arg)--;
-      if (XFASTINT (arg) > 0)
+      XSETINT (arg, XINT (arg)-1);
+      if (XINT (arg) > 0)
        Fexecute_kbd_macro (Vlast_kbd_macro, arg);
     }
   return Qnil;
@@ -164,7 +164,7 @@ defining others, use \\[name-last-kbd-macro].")
 {
   if (defining_kbd_macro)
     error ("Can't execute anonymous macro while defining one");
-  else if (NULL (Vlast_kbd_macro))
+  else if (NILP (Vlast_kbd_macro))
     error ("No kbd macro has been defined");
   else
     Fexecute_kbd_macro (Vlast_kbd_macro, prefix);
@@ -197,13 +197,11 @@ COUNT is a repeat count, or nil for once, or 0 for infinite loop.")
   int repeat = 1;
   struct gcpro gcpro1;
 
-  if (!NULL (prefixarg))
+  if (!NILP (prefixarg))
     prefixarg = Fprefix_numeric_value (prefixarg),
     repeat = XINT (prefixarg);
 
-  final = macro;
-  while (XTYPE (final) == Lisp_Symbol && !EQ (final, Qunbound))
-    final = XSYMBOL (final)->function;
+  final = indirect_function (macro);
   if (XTYPE (final) != Lisp_String
       && XTYPE (final) != Lisp_Vector)
     error ("Keyboard macros must be strings or vectors.");
@@ -219,6 +217,8 @@ COUNT is a repeat count, or nil for once, or 0 for infinite loop.")
       executing_macro_index = 0;
 
       command_loop_1 ();
+
+      QUIT;
     }
   while (--repeat && (XTYPE (Vexecuting_macro) == Lisp_String
                      || XTYPE (Vexecuting_macro) == Lisp_Vector));