* src/macros.h (at_end_of_macro_p):
* src/macros.c (at_end_of_macro_p):
New function.
* src/keyboard.c (read_char): Use the new function.
(cherry picked from commit
fbc5fb2561d9e1d4e5b69b349a26c49d30ffc938)
/* Exit the macro if we are at the end.
Also, some things replace the macro with t
to force an early exit. */
- if (EQ (Vexecuting_kbd_macro, Qt)
- || executing_kbd_macro_index >= XFIXNAT (Flength (Vexecuting_kbd_macro)))
+ if (at_end_of_macro_p ())
{
XSETINT (c, -1);
goto exit;
executing_kbd_macro = Qnil;
}
+/* Whether the execution of a macro has reached its end.
+ This should be called only while executing a macro. */
+
+bool
+at_end_of_macro_p (void)
+{
+ eassume (!NILP (Vexecuting_kbd_macro));
+ /* Some things replace the macro with t to force an early exit. */
+ return EQ (Vexecuting_kbd_macro, Qt)
+ || executing_kbd_macro_index >= XFIXNAT (Flength (Vexecuting_kbd_macro));
+}
+
void
syms_of_macros (void)
{
extern void store_kbd_macro_char (Lisp_Object);
+/* Whether the execution of a macro has reached its end.
+ This should be called only while executing a macro. */
+
+extern bool at_end_of_macro_p (void);
+
#endif /* EMACS_MACROS_H */