From: Spencer Baugh <sbaugh@janestreet.com>
To: 67046@debbugs.gnu.org
Subject: bug#67046: 29.1.50; map-y-or-n-p infinite loops if it's at the end of a kmacro
Date: Fri, 10 Nov 2023 11:47:36 -0500 [thread overview]
Message-ID: <ier8r75ftcn.fsf@janestreet.com> (raw)
In-Reply-To: <ierbkc1ftjm.fsf@janestreet.com> (Spencer Baugh's message of "Fri, 10 Nov 2023 11:43:25 -0500")
[-- Attachment #1: Type: text/plain, Size: 9 bytes --]
Patch:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Don-t-infinite-loop-in-map-y-or-n-p-if-at-the-end-of.patch --]
[-- Type: text/x-patch, Size: 1845 bytes --]
From d7aa9644b308a936926b1074d0f6eac3e425b011 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@janestreet.com>
Date: Fri, 10 Nov 2023 11:27:10 -0500
Subject: [PATCH] Don't infinite loop in map-y-or-n-p if at the end of kmacro
Previously, if map-y-or-n-p got -1 from read-event (indicating no
input due to the end of a keyboard macro), it would just infinite
loop.
Now it behaves like other commands which use read-event/read-char/etc,
and just errors when we try to look up -1 in our keymap and find
nothing.
Also, just for the sake of users, print a slightly prettier message
when this happens.
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Don't loop if we reach
the end of a keyboard macro. (Bug#67046)
---
lisp/emacs-lisp/map-ynp.el | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index cb1cc88e78f..fffb199e2ea 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -168,16 +168,14 @@ map-y-or-n-p
(key-description (vector help-char)))
(if minibuffer-auto-raise
(raise-frame (window-frame (minibuffer-window))))
- (while (progn
- (setq char (read-event))
- ;; If we get -1, from end of keyboard
- ;; macro, try again.
- (equal char -1)))
+ (setq char (read-event))
;; Show the answer to the question.
(message "%s(y, n, !, ., q, %sor %s) %s"
prompt user-keys
(key-description (vector help-char))
- (single-key-description char)))
+ (if (equal char -1)
+ "[end-of-keyboard-macro]"
+ (single-key-description char))))
(setq def (lookup-key map (vector char))))
(cond ((eq def 'exit)
(setq next (lambda () nil)))
--
2.39.3
next prev parent reply other threads:[~2023-11-10 16:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 16:43 bug#67046: 29.1.50; map-y-or-n-p infinite loops if it's at the end of a kmacro Spencer Baugh
2023-11-10 16:47 ` Spencer Baugh [this message]
2023-11-10 18:55 ` Eli Zaretskii
2023-11-10 22:35 ` Spencer Baugh
2023-11-14 22:09 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-15 12:02 ` Eli Zaretskii
2023-11-15 12:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-15 17:17 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ier8r75ftcn.fsf@janestreet.com \
--to=sbaugh@janestreet.com \
--cc=67046@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).