summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorTim Ruffing <crypto@timruffing.de>2023-12-27 14:32:09 +0100
committerStefan Monnier <monnier@iro.umontreal.ca>2024-03-10 10:40:13 -0400
commit6f46dd516b84ad7d59b49c2e9e3fc1a2d4ef4d1c (patch)
tree4075841773bcb6992af91b1ec81b21d6c0b96f9e /etc
parentd6f326452ecc761498d627a365c8014a467812eb (diff)
downloademacs-6f46dd516b84ad7d59b49c2e9e3fc1a2d4ef4d1c.tar.gz
Continue reading in 'read-event' etc. at the end of a keyboard macro
This fixes a bug that could make 'read-event', 'read-char', and 'read-char-exclusive' erroneously return -1, an internal magic return value of 'read_char' leaked from C to lisp. Instead of returning -1, the aforementioned lisp functions now transparently continue reading available input (e.g., from the keyboard) when reaching the end of a keyboard macro. * src/keyboard.c (read_char, read_key_sequence): Move handling of the end of a keyboard macro from 'read_char' to its caller 'read_key_sequence', which is the only caller that can meaningfully deal with this case. * src/macros.c (Fexecute_kbd_macro): Document how the end of keyboard macro is processed. * etc/NEWS: Announce this change.
Diffstat (limited to 'etc')
-rw-r--r--etc/NEWS12
1 files changed, 12 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 2e51c0490fe..19cd170e5c7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2141,6 +2141,18 @@ Like the variable with the same name, it adds menus from the list that
is the value of the property to context menus shown when clicking on the
text which as this property.
+---
+** Detecting the end of an iteration of a keyboard macro
+'read-event', 'read-char', and 'read-char-exclusive' no longer return -1
+when called at the end of an iteration of a the execution of a keyboard
+macro. Instead, they will transparently continue reading available input
+(e.g., from the keyboard). If you need to detect the end of a macro
+iteration, check the following condition before calling one of the
+aforementioned functions:
+
+ (and (arrayp executing-kbd-macro)
+ (>= executing-kbd-macro-index (length executing-kbd-macro))))
+
* Changes in Emacs 30.1 on Non-Free Operating Systems