diff options
| author | Tim Ruffing <crypto@timruffing.de> | 2023-12-27 14:26:26 +0100 |
|---|---|---|
| committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2024-03-10 10:40:01 -0400 |
| commit | fbc5fb2561d9e1d4e5b69b349a26c49d30ffc938 (patch) | |
| tree | 14f9a5b84f7cc25b4ba48450c0beb50a42ba3f7f /src/macros.c | |
| parent | f3da3d1c68bef60ef28d67c6d8fa5d0cba8c9f08 (diff) | |
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.
Diffstat (limited to 'src/macros.c')
| -rw-r--r-- | src/macros.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/macros.c b/src/macros.c index 5f71bcbd361..faec9dc646d 100644 --- a/src/macros.c +++ b/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) { |
