Mercurial > emacs
changeset 10910:b0edc245c9b7
(defining_kbd_macro): Delete; now part of perdisplay. All uses changed.
(kbd_macro_buffer, kbd_macro_ptr, kbd_macro_end): Likewise.
(kbd_macro_bufsize): Likewise.
(Fstart_kbd_macro): Initialize kbd_macro_buffer if not already done.
(init_macros): Delete initialization of defining_kbd_macro.
(syms_of_macros): Delete initialization of kbd_macro_buffer.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Fri, 03 Mar 1995 05:02:50 +0000 |
parents | f5dbed840520 |
children | 83fb3fdeda96 |
files | src/macros.c |
diffstat | 1 files changed, 36 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/src/macros.c Fri Mar 03 05:02:29 1995 +0000 +++ b/src/macros.c Fri Mar 03 05:02:50 1995 +0000 @@ -27,22 +27,6 @@ Lisp_Object Qexecute_kbd_macro; -int defining_kbd_macro; - -/* The start of storage for the current keyboard macro, and its size. */ -Lisp_Object *kbd_macro_buffer; -int kbd_macro_bufsize; - -/* Where to store the next keystroke of the macro. */ -Lisp_Object *kbd_macro_ptr; - -/* The finalized section of the macro starts at kbd_macro_buffer and - ends before this. This is not the same as kbd_macro_pointer, because - we advance this to kbd_macro_pointer when a key's command is complete. - This way, the keystrokes for "end-kbd-macro" are not included in the - macro. */ -Lisp_Object *kbd_macro_end; - Lisp_Object Vlast_kbd_macro; Lisp_Object Vexecuting_macro; @@ -60,23 +44,29 @@ (append) Lisp_Object append; { - if (defining_kbd_macro) + if (!NILP (current_perdisplay->defining_kbd_macro)) error ("Already defining kbd macro"); + if (!current_perdisplay->kbd_macro_buffer) + { + current_perdisplay->kbd_macro_bufsize = 30; + current_perdisplay->kbd_macro_buffer + = (Lisp_Object *)malloc (30 * sizeof (Lisp_Object)); + } update_mode_lines++; if (NILP (append)) { - kbd_macro_ptr = kbd_macro_buffer; - kbd_macro_end = kbd_macro_buffer; + current_perdisplay->kbd_macro_ptr = current_perdisplay->kbd_macro_buffer; + current_perdisplay->kbd_macro_end = current_perdisplay->kbd_macro_buffer; message("Defining kbd macro..."); } else { message("Appending to kbd macro..."); - kbd_macro_ptr = kbd_macro_end; + current_perdisplay->kbd_macro_ptr = current_perdisplay->kbd_macro_end; Fexecute_kbd_macro (Vlast_kbd_macro, make_number (1)); } - defining_kbd_macro++; + current_perdisplay->defining_kbd_macro = Qt; return Qnil; } @@ -94,7 +84,7 @@ (arg) Lisp_Object arg; { - if (!defining_kbd_macro) + if (NILP (current_perdisplay->defining_kbd_macro)) error ("Not defining kbd macro."); if (NILP (arg)) @@ -102,12 +92,14 @@ else CHECK_NUMBER (arg, 0); - if (defining_kbd_macro) + if (!NILP (current_perdisplay->defining_kbd_macro)) { - defining_kbd_macro = 0; + current_perdisplay->defining_kbd_macro = Qnil; update_mode_lines++; - Vlast_kbd_macro = make_event_array (kbd_macro_end - kbd_macro_buffer, - kbd_macro_buffer); + Vlast_kbd_macro + = make_event_array ((current_perdisplay->kbd_macro_end + - current_perdisplay->kbd_macro_buffer), + current_perdisplay->kbd_macro_buffer); message("Keyboard macro defined"); } @@ -127,19 +119,24 @@ store_kbd_macro_char (c) Lisp_Object c; { - if (defining_kbd_macro) + if (!NILP (current_perdisplay->defining_kbd_macro)) { - if (kbd_macro_ptr - kbd_macro_buffer == kbd_macro_bufsize) + if ((current_perdisplay->kbd_macro_ptr + - current_perdisplay->kbd_macro_buffer) + == current_perdisplay->kbd_macro_bufsize) { - register Lisp_Object *new - = (Lisp_Object *) xrealloc (kbd_macro_buffer, - ((kbd_macro_bufsize *= 2) - * sizeof (Lisp_Object))); - kbd_macro_ptr += new - kbd_macro_buffer; - kbd_macro_end += new - kbd_macro_buffer; - kbd_macro_buffer = new; + register Lisp_Object *new; + current_perdisplay->kbd_macro_bufsize *= 2; + new = (Lisp_Object *)xrealloc (current_perdisplay->kbd_macro_buffer, + (current_perdisplay->kbd_macro_bufsize + * sizeof (Lisp_Object))); + current_perdisplay->kbd_macro_ptr + += new - current_perdisplay->kbd_macro_buffer; + current_perdisplay->kbd_macro_end + += new - current_perdisplay->kbd_macro_buffer; + current_perdisplay->kbd_macro_buffer = new; } - *kbd_macro_ptr++ = c; + *current_perdisplay->kbd_macro_ptr++ = c; } } @@ -148,7 +145,7 @@ finalize_kbd_macro_chars () { - kbd_macro_end = kbd_macro_ptr; + current_perdisplay->kbd_macro_end = current_perdisplay->kbd_macro_ptr; } DEFUN ("call-last-kbd-macro", Fcall_last_kbd_macro, Scall_last_kbd_macro, @@ -162,7 +159,7 @@ (prefix) Lisp_Object prefix; { - if (defining_kbd_macro) + if (! NILP (current_perdisplay->defining_kbd_macro)) error ("Can't execute anonymous macro while defining one"); else if (NILP (Vlast_kbd_macro)) error ("No kbd macro has been defined"); @@ -232,17 +229,11 @@ init_macros () { Vlast_kbd_macro = Qnil; - defining_kbd_macro = 0; - Vexecuting_macro = Qnil; } syms_of_macros () { - kbd_macro_bufsize = 100; - kbd_macro_buffer = (Lisp_Object *) malloc (kbd_macro_bufsize - * sizeof (Lisp_Object)); - Qexecute_kbd_macro = intern ("execute-kbd-macro"); staticpro (&Qexecute_kbd_macro); @@ -251,7 +242,7 @@ defsubr (&Scall_last_kbd_macro); defsubr (&Sexecute_kbd_macro); - DEFVAR_BOOL ("defining-kbd-macro", &defining_kbd_macro, + DEFVAR_DISPLAY ("defining-kbd-macro", defining_kbd_macro, "Non-nil while a keyboard macro is being defined. Don't set this!"); DEFVAR_LISP ("executing-macro", &Vexecuting_macro,