-DEFUN ("end-kbd-macro", Fend_kbd_macro, Send_kbd_macro, 0, 1, "p",
- "Finish defining a keyboard macro.\n\
-The definition was started by \\[start-kbd-macro].\n\
-The macro is now available for use via \\[call-last-kbd-macro],\n\
-or it can be given a name with \\[name-last-kbd-macro] and then invoked\n\
-under that name.\n\
-\n\
-With numeric arg, repeat macro now that many times,\n\
-counting the definition just completed as the first repetition.\n\
-An argument of zero means repeat until error.")
- (repeat)
- Lisp_Object repeat;
+/* Finish defining the current keyboard macro. */
+
+void
+end_kbd_macro ()
+{
+ current_kboard->defining_kbd_macro = Qnil;
+ update_mode_lines++;
+ current_kboard->Vlast_kbd_macro
+ = make_event_array ((current_kboard->kbd_macro_end
+ - current_kboard->kbd_macro_buffer),
+ current_kboard->kbd_macro_buffer);
+}
+
+DEFUN ("end-kbd-macro", Fend_kbd_macro, Send_kbd_macro, 0, 2, "p",
+ doc: /* Finish defining a keyboard macro.
+The definition was started by \\[start-kbd-macro].
+The macro is now available for use via \\[call-last-kbd-macro],
+or it can be given a name with \\[name-last-kbd-macro] and then invoked
+under that name.
+
+With numeric arg, repeat macro now that many times,
+counting the definition just completed as the first repetition.
+An argument of zero means repeat until error.
+
+In Lisp, optional second arg LOOPFUNC may be a function that is called prior to
+each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
+ (repeat, loopfunc)
+ Lisp_Object repeat, loopfunc;