Mercurial > hg > xemacs-beta
comparison src/macros.c @ 284:558f606b08ae r21-0b40
Import from CVS: tag r21-0b40
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:34:13 +0200 |
parents | 7df0dd720c89 |
children | 341dac730539 |
comparison
equal
deleted
inserted
replaced
283:fa3d41851a08 | 284:558f606b08ae |
---|---|
85 con->defining_kbd_macro = Qt; | 85 con->defining_kbd_macro = Qt; |
86 | 86 |
87 return Qnil; | 87 return Qnil; |
88 } | 88 } |
89 | 89 |
90 DEFUN ("end-kbd-macro", Fend_kbd_macro, 0, 2, "P", /* | 90 DEFUN ("end-kbd-macro", Fend_kbd_macro, 0, 1, "P", /* |
91 Finish defining a keyboard macro. | 91 Finish defining a keyboard macro. |
92 The definition was started by \\[start-kbd-macro]. | 92 The definition was started by \\[start-kbd-macro]. |
93 The macro is now available for use via \\[call-last-kbd-macro], | 93 The macro is now available for use via \\[call-last-kbd-macro], |
94 or it can be given a name with \\[name-last-kbd-macro] and then invoked | 94 or it can be given a name with \\[name-last-kbd-macro] and then invoked |
95 under that name. | 95 under that name. |
96 | 96 |
97 With numeric arg, repeat macro now that many times, | 97 With numeric arg, repeat macro now that many times, |
98 counting the definition just completed as the first repetition. | 98 counting the definition just completed as the first repetition. |
99 An argument of zero means repeat until error. | 99 An argument of zero means repeat until error. |
100 | 100 */ |
101 If REMOVE-LAST is an integer, it means to not record the last number | 101 (arg)) |
102 of events. This is used internally and will likely be removed. | |
103 */ | |
104 (arg, remove_last)) | |
105 { | 102 { |
106 /* This function can GC */ | 103 /* This function can GC */ |
107 struct console *con = XCONSOLE (Vselected_console); | 104 struct console *con = XCONSOLE (Vselected_console); |
108 int repeat, kill; | 105 int repeat; |
109 | 106 |
110 if (NILP (con->defining_kbd_macro)) | 107 if (NILP (con->defining_kbd_macro)) |
111 error ("Not defining kbd macro."); | 108 error ("Not defining kbd macro."); |
112 | |
113 /* #### Read the comment in modeline.el to see why this ugliness is | |
114 needed. #### Try to avoid it, somehow! */ | |
115 if (!NILP (remove_last)) | |
116 { | |
117 CHECK_NATNUM (remove_last); | |
118 kill = XINT (remove_last); | |
119 } | |
120 else | |
121 kill = 0; | |
122 | 109 |
123 if (NILP (arg)) | 110 if (NILP (arg)) |
124 repeat = -1; | 111 repeat = -1; |
125 else | 112 else |
126 repeat = XINT (Fprefix_numeric_value (arg)); | 113 repeat = XINT (Fprefix_numeric_value (arg)); |
127 | 114 |
128 if (!NILP (con->defining_kbd_macro)) | 115 if (!NILP (con->defining_kbd_macro)) |
129 { | 116 { |
130 int i; | 117 int i; |
131 int size = con->kbd_macro_end - kill; | 118 int size = con->kbd_macro_end; |
132 | 119 |
133 if (size < 0) | 120 if (size < 0) |
134 size = 0; | 121 size = 0; |
135 con->last_kbd_macro = make_vector (size, Qnil); | 122 con->last_kbd_macro = make_vector (size, Qnil); |
136 for (i = 0; i < size; i++) | 123 for (i = 0; i < size; i++) |
150 else | 137 else |
151 return Fexecute_kbd_macro (con->last_kbd_macro, | 138 return Fexecute_kbd_macro (con->last_kbd_macro, |
152 make_int (repeat - 1)); | 139 make_int (repeat - 1)); |
153 } | 140 } |
154 | 141 |
142 /* #### Read the comment in modeline.el to see why this ugliness is | |
143 needed. #### Try to avoid it, somehow! */ | |
144 DEFUN ("zap-last-kbd-macro-event", Fzap_last_kbd_macro_event, 0, 0, 0, /* | |
145 Don't look at this lest you vomit or spontaneously combust. | |
146 */ | |
147 ()) | |
148 { | |
149 struct console *con = XCONSOLE (Vselected_console); | |
150 if (con->kbd_macro_end) | |
151 --con->kbd_macro_end; | |
152 return Qnil; | |
153 } | |
155 | 154 |
156 /* Store event into kbd macro being defined | 155 /* Store event into kbd macro being defined |
157 */ | 156 */ |
158 void | 157 void |
159 store_kbd_macro_event (Lisp_Object event) | 158 store_kbd_macro_event (Lisp_Object event) |
302 void | 301 void |
303 syms_of_macros (void) | 302 syms_of_macros (void) |
304 { | 303 { |
305 DEFSUBR (Fstart_kbd_macro); | 304 DEFSUBR (Fstart_kbd_macro); |
306 DEFSUBR (Fend_kbd_macro); | 305 DEFSUBR (Fend_kbd_macro); |
306 DEFSUBR (Fzap_last_kbd_macro_event); | |
307 DEFSUBR (Fcall_last_kbd_macro); | 307 DEFSUBR (Fcall_last_kbd_macro); |
308 DEFSUBR (Fexecute_kbd_macro); | 308 DEFSUBR (Fexecute_kbd_macro); |
309 DEFSUBR (Fcancel_kbd_macro_events); | 309 DEFSUBR (Fcancel_kbd_macro_events); |
310 defsymbol (&Qexecute_kbd_macro, "execute-kbd-macro"); | 310 defsymbol (&Qexecute_kbd_macro, "execute-kbd-macro"); |
311 } | 311 } |