mirror of git://git.sv.gnu.org/emacs.git
Extract check for end of macro to function
* 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.feature/positioned-lambdas
parent
f3da3d1c68
commit
fbc5fb2561
|
@ -2637,8 +2637,7 @@ read_char (int commandflag, Lisp_Object map,
|
|||
/* 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;
|
||||
|
|
12
src/macros.c
12
src/macros.c
|
@ -353,6 +353,18 @@ init_macros (void)
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -47,4 +47,9 @@ extern void finalize_kbd_macro_chars (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 */
|
||||
|
|
Loading…
Reference in New Issue