From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs 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 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27536"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 67046@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 10 17:48:34 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r1UgL-0009cI-PE for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Nov 2023 17:48:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r1UgB-0007tJ-NX; Fri, 10 Nov 2023 11:48:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r1UgA-0007sa-Ha for bug-gnu-emacs@gnu.org; Fri, 10 Nov 2023 11:48:22 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r1UgA-00033B-9Z for bug-gnu-emacs@gnu.org; Fri, 10 Nov 2023 11:48:22 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r1Ugo-00016K-38 for bug-gnu-emacs@gnu.org; Fri, 10 Nov 2023 11:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Nov 2023 16:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67046 X-GNU-PR-Package: emacs Original-Received: via spool by 67046-submit@debbugs.gnu.org id=B67046.16996349054005 (code B ref 67046); Fri, 10 Nov 2023 16:49:02 +0000 Original-Received: (at 67046) by debbugs.gnu.org; 10 Nov 2023 16:48:25 +0000 Original-Received: from localhost ([127.0.0.1]:50752 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r1UgD-00012V-9L for submit@debbugs.gnu.org; Fri, 10 Nov 2023 11:48:25 -0500 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:49929) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r1UgA-00011o-6M for 67046@debbugs.gnu.org; Fri, 10 Nov 2023 11:48:24 -0500 In-Reply-To: (Spencer Baugh's message of "Fri, 10 Nov 2023 11:43:25 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275482 --=-=-= Content-Type: text/plain Patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Don-t-infinite-loop-in-map-y-or-n-p-if-at-the-end-of.patch >From d7aa9644b308a936926b1074d0f6eac3e425b011 Mon Sep 17 00:00:00 2001 From: Spencer Baugh 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 --=-=-=--