From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#66998: 29.1; Regression for recursive keyboard macros + minibuffers in (I think) Emacs 28 Date: Fri, 10 Nov 2023 18:57:17 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1954"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eliz@gnu.org, 66998@debbugs.gnu.org To: Morgon Kanter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 10 19:58:32 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 1r1Wi8-0005SD-0N for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Nov 2023 19:58:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r1Wi0-0005pr-Kl; Fri, 10 Nov 2023 13:58:24 -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 1r1Why-0005pf-MN for bug-gnu-emacs@gnu.org; Fri, 10 Nov 2023 13:58: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 1r1Why-0001Fx-EU for bug-gnu-emacs@gnu.org; Fri, 10 Nov 2023 13:58:22 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r1Wic-0004Xf-9g for bug-gnu-emacs@gnu.org; Fri, 10 Nov 2023 13:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Nov 2023 18:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66998 X-GNU-PR-Package: emacs Original-Received: via spool by 66998-submit@debbugs.gnu.org id=B66998.169964270217406 (code B ref 66998); Fri, 10 Nov 2023 18:59:02 +0000 Original-Received: (at 66998) by debbugs.gnu.org; 10 Nov 2023 18:58:22 +0000 Original-Received: from localhost ([127.0.0.1]:50868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r1Whx-0004Wg-NA for submit@debbugs.gnu.org; Fri, 10 Nov 2023 13:58:22 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:54102) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r1Whg-0004Vr-Pj for 66998@debbugs.gnu.org; Fri, 10 Nov 2023 13:58:20 -0500 Original-Received: (qmail 94940 invoked by uid 3782); 10 Nov 2023 19:57:18 +0100 Original-Received: from acm.muc.de (p4fe158a9.dip0.t-ipconnect.de [79.225.88.169]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 10 Nov 2023 19:57:18 +0100 Original-Received: (qmail 25064 invoked by uid 1000); 10 Nov 2023 18:57:17 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:275489 Hello, Morgon. On Thu, Nov 09, 2023 at 13:41:26 -0500, Morgon Kanter wrote: > Hi Alan, > tl;dr: you're right, not a bug, just user error :-) > Trying this one more time, I rediscovered how to turn on "plain text > mode". So I hope this one doesn't get garbled HTML. Thanks, appreciated! > First, this was the original code that got garbled. It should be > visible in the mailing list archive in a web browser. Pasted again > here: > > (defun config:macro-query (arg) > > "Prompt for input using minibuffer during kbd macro execution. > > With prefix argument, allows you to select what prompt string to use. > > If the input is non-empty, it is inserted at point." > > (interactive "P") > > (let* ((prompt (if arg (read-from-minibuffer "PROMPT: ") "Input: ")) > > (input (minibuffer-with-setup-hook (lambda () (kbd-macro-query t)) > > (read-from-minibuffer prompt)))) > Your intuition was totally right. This isn't really a bug, and > probably not a regression in behavior either. Use of C-M-c to exit the > recursive edit before the minibuffer works as expected. The only > "problem" is that you need to press C-M-c to terminate the minibuffer, > rather than RET. That's a bit awkward and weird, but it's livable. I > could probably temporarily rebind RET to make it more ergonomic. But > the truth is that from Emacs's perspective this isn't even something > that *should* be fixed -- you *should* be exiting the recursive edit > before you exit the minibuffer, in that order! It should be possible in Emacs to do what you want to do. I've not been able to come up with any clean way to do this, even after sleeping on it. It seems there is a deficiency in Emacs's keyboard macro handling. I think we need a new interactive command called something like interpolate-kbd-macro, which would take one argument, a function to run. This function would take no arguments and return a list of key sequences. These key sequences, rather than being inserted into the keyboard macro, would instead be looked up in the current keymaps, and their commands (e.g. self-insert-command) would get run as part of the current keyboard macro invocation. Or something like that. What do you think? > So this, at least, is WAI and this bug should be closed. WAI? That's a new one on me! Possibly a new bug should be opened to implement my suggestion above. > > So I think the error message "Not in most nested command loop" is > > correct, even if its not very clear in this context. > > What are you actually trying to achieve in your real Lisp code with this > > recursive edit? At first acquaintance, it looks rather unusual. > What I am trying to achieve is the ability to prompt the user as part > of a keyboard macro, and receive input which the macro will then do > something with. Importantly, this input could be different every time > the keyboard macro is run. Ordinarily if you were to prompt the user > for input, all those actions would be considered part of the keyboard > macro and simply re-run every time. So you need to invoke the > recursive edit to make it work. OK, thanks. -- Alan Mackenzie (Nuremberg, Germany).