X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/37d2e431f35492c14510f9960cac94c2f21b6ecb..2bfa3d3e1fb347ba76bddf77f3e288049635821d:/src/macros.c diff --git a/src/macros.c b/src/macros.c index 48d23a977b..d82ec8bb82 100644 --- a/src/macros.c +++ b/src/macros.c @@ -1,6 +1,6 @@ /* Keyboard macros. -Copyright (C) 1985-1986, 1993, 2000-2013 Free Software Foundation, Inc. +Copyright (C) 1985-1986, 1993, 2000-2014 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -45,8 +45,6 @@ EMACS_INT executing_kbd_macro_iterations; Lisp_Object executing_kbd_macro; -Lisp_Object Fexecute_kbd_macro (Lisp_Object macro, Lisp_Object count, Lisp_Object loopfunc); - DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 2, "P", doc: /* Record subsequent keyboard input, defining a keyboard macro. The commands are recorded even as they are executed. @@ -55,7 +53,7 @@ Use \\[name-last-kbd-macro] to give it a permanent name. Non-nil arg (prefix arg) means append to last macro defined; this begins by re-executing that macro as if you typed it again. If optional second arg, NO-EXEC, is non-nil, do not re-execute last -macro before appending to it. */) +macro before appending to it. */) (Lisp_Object append, Lisp_Object no_exec) { if (!NILP (KVAR (current_kboard, defining_kbd_macro))) @@ -66,7 +64,7 @@ macro before appending to it. */) current_kboard->kbd_macro_buffer = xmalloc (30 * word_size); current_kboard->kbd_macro_bufsize = 30; } - update_mode_lines++; + update_mode_lines = 19; if (NILP (append)) { if (current_kboard->kbd_macro_bufsize > 200) @@ -138,7 +136,7 @@ void end_kbd_macro (void) { kset_defining_kbd_macro (current_kboard, Qnil); - update_mode_lines++; + update_mode_lines = 20; kset_last_kbd_macro (current_kboard, make_event_array ((current_kboard->kbd_macro_end @@ -279,7 +277,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) /* Restore Vexecuting_kbd_macro and executing_kbd_macro_index. Called when the unwind-protect in Fexecute_kbd_macro gets invoked. */ -static Lisp_Object +static void pop_kbd_macro (Lisp_Object info) { Lisp_Object tem; @@ -288,12 +286,12 @@ pop_kbd_macro (Lisp_Object info) executing_kbd_macro_index = XINT (XCAR (tem)); Vreal_this_command = XCDR (tem); Frun_hooks (1, &Qkbd_macro_termination_hook); - return Qnil; } DEFUN ("execute-kbd-macro", Fexecute_kbd_macro, Sexecute_kbd_macro, 1, 3, 0, doc: /* Execute MACRO as string of editor command characters. -If MACRO is a symbol, its function definition is used. +MACRO can also be a vector of keyboard events. If MACRO is a symbol, +its function definition is used. COUNT is a repeat count, or nil for once, or 0 for infinite loop. Optional third arg LOOPFUNC may be a function that is called prior to @@ -302,7 +300,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) { Lisp_Object final; Lisp_Object tem; - ptrdiff_t pdlcount = SPECPDL_INDEX (); + dynwind_begin (); EMACS_INT repeat = 1; struct gcpro gcpro1, gcpro2; EMACS_INT success_count = 0; @@ -355,7 +353,8 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) Vreal_this_command = Vexecuting_kbd_macro; UNGCPRO; - return unbind_to (pdlcount, Qnil); + dynwind_end (); + return Qnil; } void @@ -368,6 +367,8 @@ init_macros (void) void syms_of_macros (void) { +#include "macros.x" + DEFSYM (Qexecute_kbd_macro, "execute-kbd-macro"); DEFVAR_LISP ("kbd-macro-termination-hook", Vkbd_macro_termination_hook, @@ -376,13 +377,6 @@ This is run whether the macro ends normally or prematurely due to an error. */) Vkbd_macro_termination_hook = Qnil; DEFSYM (Qkbd_macro_termination_hook, "kbd-macro-termination-hook"); - defsubr (&Sstart_kbd_macro); - defsubr (&Send_kbd_macro); - defsubr (&Scall_last_kbd_macro); - defsubr (&Sexecute_kbd_macro); - defsubr (&Scancel_kbd_macro_events); - defsubr (&Sstore_kbd_macro_event); - DEFVAR_KBOARD ("defining-kbd-macro", defining_kbd_macro, doc: /* Non-nil while a keyboard macro is being defined. Don't set this! The value is the symbol `append' while appending to the definition of