GNU bug report logs - #48603
27.2; [PATCH] Quit minibuffers without aborting kmacros

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: miha@HIDDEN; Keywords: patch; dated Sun, 23 May 2021 14:32:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 48603 <at> debbugs.gnu.org:


Received: (at 48603) by debbugs.gnu.org; 25 May 2021 19:55:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 15:55:11 2021
Received: from localhost ([127.0.0.1]:46949 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lld8x-0000NQ-Hy
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 15:55:11 -0400
Received: from quimby.gnus.org ([95.216.78.240]:49124)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1lld8v-0000N8-2O
 for 48603 <at> debbugs.gnu.org; Tue, 25 May 2021 15:55:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=LOjdOxdiyPE6cbsrDrLfmK7oqIs8zAjtwiNvt9aMqQo=; b=Ckfo01x9V2LUtNmBdshDFEkHFK
 ljHHTXDMXxlgehJHgpOjC3vgdbbu9zgw5PiRhN/8V4wepme8IF2LJqV7ssd3O6484IyuGCIiZdjlR
 6gqCkUM08gJFl4ZRLRptklQEhEzy5MVkaRBalpGVGG1hxcgp5IsTliwrIgEc38l2rnyw=;
Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1lld8m-0004Y2-5N; Tue, 25 May 2021 21:55:02 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: miha@HIDDEN
Subject: Re: bug#48603: 27.2; [PATCH] Quit minibuffers without aborting kmacros
References: <86eedx7c0u.fsf@miha-pc>
X-Now-Playing: Satomimagae's _awa_: "riki"
Date: Tue, 25 May 2021 21:54:59 +0200
In-Reply-To: <86eedx7c0u.fsf@miha-pc> (miha@HIDDEN's message of "Sun,
 23 May 2021 16:36:17 +0200")
Message-ID: <877djmegh8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: miha@HIDDEN writes: > Rationale: a user wants to copy
 a command from command history without > executing it. Or user wants to
 complete
 a file name in C-x C-f and copy > it without finding the file. I believe
 this should [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: miha@HIDDEN writes: > Rationale: a user wants to copy
 a command from command history without > executing it. Or user wants to
 complete
 a file name in C-x C-f and copy > it without finding the file. I believe
 this should [...] 
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: kamnitnik.top (top)]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [95.216.78.240 listed in list.dnswl.org]
X-Debbugs-Envelope-To: 48603
Cc: 48603 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

miha@HIDDEN writes:

> Rationale: a user wants to copy a command from command history without
> executing it. Or user wants to complete a file name in C-x C-f and copy
> it without finding the file. I believe this should be possible in
> keyboard macros.

`C-g' is part of how one normally operates `M-x' (etc.) in some
circumstances, so it might make sense to have a special quit symbol for
that; yes.

Does anybody else have an opinion here?

> * src/data.c (syms_of_data): New error symbol `lite-quit'

But it should be called something more descriptive, like
`minibuffer-quit'.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#48603; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 May 2021 14:31:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 23 10:31:13 2021
Received: from localhost ([127.0.0.1]:41505 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lkp8L-0008Rn-9z
	for submit <at> debbugs.gnu.org; Sun, 23 May 2021 10:31:13 -0400
Received: from lists.gnu.org ([209.51.188.17]:34026)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <miha@HIDDEN>) id 1lkp8G-0008Rb-6b
 for submit <at> debbugs.gnu.org; Sun, 23 May 2021 10:31:11 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:52866)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <miha@HIDDEN>)
 id 1lkp8E-00019V-14
 for bug-gnu-emacs@HIDDEN; Sun, 23 May 2021 10:31:08 -0400
Received: from kamnitnik.top ([2001:19f0:5001:bf2:5400:2ff:fee0:2626]:35894
 helo=mail.kamnitnik.top)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <miha@HIDDEN>)
 id 1lkp8A-0002zt-4O
 for bug-gnu-emacs@HIDDEN; Sun, 23 May 2021 10:31:05 -0400
Received: from localhost (unknown [IPv6:2a00:ee2:e04:9300:b7eb:7ae7:cc56:e0da])
 by mail.kamnitnik.top (Postfix) with ESMTPSA id 4DD03BBB78
 for <bug-gnu-emacs@HIDDEN>; Sun, 23 May 2021 14:30:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top;
 s=mail; t=1621780256;
 bh=38jQOKJWp9xT8JApHW6CsgPpw68ikl2C1HArji2wxWk=;
 h=From:To:Subject:Date:From;
 b=Qw/n1aqS/pubjltgJbvTCtEFMLyDnsHWYJAEVz4fA+6kPIaBdYYCftXdNBOZQkUaE
 m6xFfbn+sBjtpWoa8d5mghzq+GihIB+rhCfgsvVTcMprgDQ/SmPgpnO0eyGKRjOnBi
 pTA09/s2+H2Tdk83lcBdnhclSdnhZ+vVl4XrEF2X5slan9/pX57s/WRiD+hOKDDD9+
 Rn2k5Q7XLHFiplRP6EcgYzN5zuyu1rFYytRye34AqIeAsphnkEFfoZDJ8TWWDKF8Ck
 SgdBUxiBwN5rpsFpIAJ0ASHvJ7Sgepfrn3G+3EdQbO2WFNxIa7HMFBALrvRPq9644i
 WM4PVA+zDNcww==
From: miha@HIDDEN
To: bug-gnu-emacs@HIDDEN
Subject: 27.2; [PATCH] Quit minibuffers without aborting kmacros
Date: Sun, 23 May 2021 16:36:17 +0200
Message-ID: <86eedx7c0u.fsf@miha-pc>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2001:19f0:5001:bf2:5400:2ff:fee0:2626;
 envelope-from=miha@HIDDEN; helo=mail.kamnitnik.top
X-Spam_score_int: 23
X-Spam_score: 2.3
X-Spam_bar: ++
X-Spam_report: (2.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499,
 FROM_SUSPICIOUS_NTLD_FP=1.901, PDS_OTHER_BAD_TLD=1.999, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 3.0 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: Rationale: a user wants to copy a command from command
 history
 without executing it. Or user wants to complete a file name in C-x C-f and
 copy it without finding the file. I believe this should be pos [...] 
 Content analysis details:   (3.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.9 SPF_FAIL               SPF: sender does not match SPF record (fail)
 [SPF failed: Please see http://www.openspf.org/Why?s=mfrom;
 id=miha%40kamnitnik.top; ip=209.51.188.17; r=debbugs.gnu.org]
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: kamnitnik.top (top)]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -0.0 RCVD_IN_MSPIKE_H4      RBL: Very Good reputation (+4)
 [209.51.188.17 listed in wl.mailspike.net]
 -2.3 RCVD_IN_DNSWL_MED      RBL: Sender listed at https://www.dnswl.org/,
 medium trust [209.51.188.17 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
 0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
 1.9 FROM_SUSPICIOUS_NTLD_FP From abused NTLD
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.1 (/)

--=-=-=
Content-Type: text/plain
Content-Disposition: inline


Rationale: a user wants to copy a command from command history without
executing it. Or user wants to complete a file name in C-x C-f and copy
it without finding the file. I believe this should be possible in
keyboard macros.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-Quit-minibuffers-without-aborting-kmacros.patch

From 5513841b55e47f05f3e049ffcb71a0fc56287fbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miha=20Rihtar=C5=A1i=C4=8D?= <miha@HIDDEN>
Date: Sun, 23 May 2021 16:08:43 +0200
Subject: [PATCH] Quit minibuffers without aborting kmacros

* src/data.c (syms_of_data): New error symbol `lite-quit'

* src/keyboard.c (recursive_edit_1): Implement throwing of function
values to `exit`.  In that case, the function will be called without
arguments before returning from the command loop.
(cmd_error):
(Fcommand_error_default_function): Do not abort keyboard macro
execution if lite-quit is signaled.
(command_loop_2): New argument HANDLERS.

* src/macros.c (Fexecute_kbd_macro): Use command_loop_2 instead of
command_loop_1.

* doc/lispref/commands.texi (Quitting): Document `lite-quit'
(Recursive Editing): Document throwing of function values to `exit'.

* doc/lispref/errors.texi (Standard Errors): Document `lite-quit'

* lisp/minibuffer.el (lite-quit-recursive-edit): New function.

* src/minibuf.c (Fabort_minibuffers): Use it.

* lisp/simple.el (minibuffer-error-function): Do not abort keyboard
macro execution if is lite-quit is signaled.
---
 doc/lispref/commands.texi | 14 +++++++++---
 doc/lispref/errors.texi   |  9 ++++++--
 lisp/minibuffer.el        |  9 ++++++++
 lisp/simple.el            |  6 ++++--
 src/data.c                |  2 ++
 src/keyboard.c            | 45 ++++++++++++++++++++++++++++-----------
 src/lisp.h                |  2 +-
 src/macros.c              |  2 +-
 src/minibuf.c             |  2 +-
 9 files changed, 69 insertions(+), 22 deletions(-)

diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 8199ece110..a0b99ed144 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -3378,6 +3378,12 @@ Quitting
 in @ref{Errors}.)
 @end deffn
 
+  To quit without aborting keyboard macro definition or execution, you
+can signal the @code{lite-quit} condition.  This has almost the same
+effect as the @code{quit} condition except that the error handling in
+the command loop handles it without breaking keyboard macro definition
+or execution.
+
   You can specify a character other than @kbd{C-g} to use for quitting.
 See the function @code{set-input-mode} in @ref{Input Modes}.
 
@@ -3562,12 +3568,14 @@ Recursive Editing
 @code{recursive-edit}.  This function contains the command loop; it also
 contains a call to @code{catch} with tag @code{exit}, which makes it
 possible to exit the recursive editing level by throwing to @code{exit}
-(@pxref{Catch and Throw}).  If you throw a value other than @code{t},
-then @code{recursive-edit} returns normally to the function that called
-it.  The command @kbd{C-M-c} (@code{exit-recursive-edit}) does this.
+(@pxref{Catch and Throw}).  If you throw a @code{nil} value, then
+@code{recursive-edit} returns normally to the function that called it.
+The command @kbd{C-M-c} (@code{exit-recursive-edit}) does this.
 Throwing a @code{t} value causes @code{recursive-edit} to quit, so that
 control returns to the command loop one level up.  This is called
 @dfn{aborting}, and is done by @kbd{C-]} (@code{abort-recursive-edit}).
+You can also throw a function value.  In that case,
+@code{recursive-edit} will call it without arguments before returning.
 
   Most applications should not use recursive editing, except as part of
 using the minibuffer.  Usually it is more convenient for the user if you
diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi
index fb393b951f..a45489db8e 100644
--- a/doc/lispref/errors.texi
+++ b/doc/lispref/errors.texi
@@ -20,8 +20,9 @@ Standard Errors
 we do not say here that a certain error symbol has additional error
 conditions, that means it has none.
 
-  As a special exception, the error symbol @code{quit} does not have the
-condition @code{error}, because quitting is not considered an error.
+  As a special exception, the error symbols @code{quit} and
+@code{lite-quit} don't have the condition @code{error}, because quitting
+is not considered an error.
 
   Most of these error symbols are defined in C (mainly @file{data.c}),
 but some are defined in Lisp.  For example, the file @file{userlock.el}
@@ -40,6 +41,10 @@ Standard Errors
 @item quit
 The message is @samp{Quit}.  @xref{Quitting}.
 
+@item lite-quit
+The message is @samp{Quit}.  This is a subcategory of @code{quit}.
+@xref{Quitting}.
+
 @item args-out-of-range
 The message is @samp{Args out of range}.  This happens when trying to
 access an element beyond the range of a sequence, buffer, or other
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index e04f1040b3..d1b88b0355 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2318,6 +2318,15 @@ exit-minibuffer
   (setq deactivate-mark nil)
   (throw 'exit nil))
 
+(defun lite-quit-recursive-edit ()
+  "Quit the command that requested this recursive edit wihtout error.
+Like `abort-recursive-edit' wihtout aborting keyboard macro
+execution."
+  ;; See Info node `(elisp)Recursive Editing' for an explanation of
+  ;; throwing a function to `exit'.
+  (throw 'exit (lambda ()
+                 (signal 'lite-quit nil))))
+
 (defun self-insert-and-exit ()
   "Terminate minibuffer input."
   (interactive)
diff --git a/lisp/simple.el b/lisp/simple.el
index 2a90a07631..191c9d482d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2854,8 +2854,10 @@ minibuffer-error-function
 The same as `command-error-default-function' but display error messages
 at the end of the minibuffer using `minibuffer-message' to not obscure
 the minibuffer contents."
-  (discard-input)
-  (ding)
+  (if (memq 'lite-quit (get (car data) 'error-conditions))
+      (ding t)
+    (discard-input)
+    (ding))
   (let ((string (error-message-string data)))
     ;; If we know from where the error was signaled, show it in
     ;; *Messages*.
diff --git a/src/data.c b/src/data.c
index d547f5da5e..315d43942c 100644
--- a/src/data.c
+++ b/src/data.c
@@ -3899,6 +3899,7 @@ syms_of_data (void)
   DEFSYM (Qerror, "error");
   DEFSYM (Quser_error, "user-error");
   DEFSYM (Qquit, "quit");
+  DEFSYM (Qlite_quit, "lite-quit");
   DEFSYM (Qwrong_length_argument, "wrong-length-argument");
   DEFSYM (Qwrong_type_argument, "wrong-type-argument");
   DEFSYM (Qargs_out_of_range, "args-out-of-range");
@@ -3971,6 +3972,7 @@ #define PUT_ERROR(sym, tail, msg)			\
   Fput (sym, Qerror_message, build_pure_c_string (msg))
 
   PUT_ERROR (Qquit, Qnil, "Quit");
+  PUT_ERROR (Qlite_quit, pure_cons (Qquit, Qnil), "Quit");
 
   PUT_ERROR (Quser_error, error_tail, "");
   PUT_ERROR (Qwrong_length_argument, error_tail, "Wrong length argument");
diff --git a/src/keyboard.c b/src/keyboard.c
index 47b5e59024..10e1386023 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -725,6 +725,9 @@ recursive_edit_1 (void)
   if (STRINGP (val))
     xsignal1 (Qerror, val);
 
+  if (FUNCTIONP (val))
+    call0 (val);
+
   return unbind_to (count, Qnil);
 }
 
@@ -921,6 +924,7 @@ restore_kboard_configuration (int was_locked)
 cmd_error (Lisp_Object data)
 {
   Lisp_Object old_level, old_length;
+  Lisp_Object conditions;
   char macroerror[sizeof "After..kbd macro iterations: "
 		  + INT_STRLEN_BOUND (EMACS_INT)];
 
@@ -940,10 +944,15 @@ cmd_error (Lisp_Object data)
   else
     *macroerror = 0;
 
+  conditions = Fget (XCAR (data), Qerror_conditions);
+  if (NILP (Fmemq (Qlite_quit, conditions)))
+    {
+      Vexecuting_kbd_macro = Qnil;
+      executing_kbd_macro = Qnil;
+    }
+
   Vstandard_output = Qt;
   Vstandard_input = Qt;
-  Vexecuting_kbd_macro = Qnil;
-  executing_kbd_macro = Qnil;
   kset_prefix_arg (current_kboard, Qnil);
   kset_last_prefix_arg (current_kboard, Qnil);
   cancel_echoing ();
@@ -998,6 +1007,7 @@ DEFUN ("command-error-default-function", Fcommand_error_default_function,
   (Lisp_Object data, Lisp_Object context, Lisp_Object signal)
 {
   struct frame *sf = SELECTED_FRAME ();
+  Lisp_Object conditions;
 
   CHECK_STRING (context);
 
@@ -1024,17 +1034,27 @@ DEFUN ("command-error-default-function", Fcommand_error_default_function,
     }
   else
     {
+      conditions = Fget (XCAR (data), Qerror_conditions);
+
       clear_message (1, 0);
-      Fdiscard_input ();
       message_log_maybe_newline ();
-      bitch_at_user ();
+
+      if (!NILP (Fmemq (Qlite_quit, conditions)))
+	{
+	  Fding (Qt);
+	}
+      else
+	{
+	  Fdiscard_input ();
+	  bitch_at_user ();
+	}
 
       print_error_message (data, Qt, SSDATA (context), signal);
     }
   return Qnil;
 }
 
-static Lisp_Object command_loop_2 (Lisp_Object);
+static Lisp_Object command_loop_1 (void);
 static Lisp_Object top_level_1 (Lisp_Object);
 
 /* Entry to editor-command-loop.
@@ -1062,7 +1082,7 @@ command_loop (void)
   if (command_loop_level > 0 || minibuf_level > 0)
     {
       Lisp_Object val;
-      val = internal_catch (Qexit, command_loop_2, Qnil);
+      val = internal_catch (Qexit, command_loop_2, Qerror);
       executing_kbd_macro = Qnil;
       return val;
     }
@@ -1070,7 +1090,7 @@ command_loop (void)
     while (1)
       {
 	internal_catch (Qtop_level, top_level_1, Qnil);
-	internal_catch (Qtop_level, command_loop_2, Qnil);
+	internal_catch (Qtop_level, command_loop_2, Qerror);
 	executing_kbd_macro = Qnil;
 
 	/* End of file in -batch run causes exit here.  */
@@ -1083,15 +1103,16 @@ command_loop (void)
    editing loop, and reenter the editing loop.
    When there is an error, cmd_error runs and returns a non-nil
    value to us.  A value of nil means that command_loop_1 itself
-   returned due to end of file (or end of kbd macro).  */
+   returned due to end of file (or end of kbd macro).  HANDLERS is a
+   list of condition names, passed to internal_condition_case.  */
 
-static Lisp_Object
-command_loop_2 (Lisp_Object ignore)
+Lisp_Object
+command_loop_2 (Lisp_Object handlers)
 {
   register Lisp_Object val;
 
   do
-    val = internal_condition_case (command_loop_1, Qerror, cmd_error);
+    val = internal_condition_case (command_loop_1, handlers, cmd_error);
   while (!NILP (val));
 
   return Qnil;
@@ -1234,7 +1255,7 @@ some_mouse_moved (void)
                               bool, bool, bool, bool);
 static void adjust_point_for_property (ptrdiff_t, bool);
 
-Lisp_Object
+static Lisp_Object
 command_loop_1 (void)
 {
   modiff_count prev_modiff = 0;
diff --git a/src/lisp.h b/src/lisp.h
index 91b7a89d0f..a30d7b861d 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4417,7 +4417,7 @@ fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string)
 extern bool detect_input_pending_run_timers (bool);
 extern void safe_run_hooks (Lisp_Object);
 extern void cmd_error_internal (Lisp_Object, const char *);
-extern Lisp_Object command_loop_1 (void);
+extern Lisp_Object command_loop_2 (Lisp_Object);
 extern Lisp_Object read_menu_command (void);
 extern Lisp_Object recursive_edit_1 (void);
 extern void record_auto_save (void);
diff --git a/src/macros.c b/src/macros.c
index 60d0766a75..53ad727a5b 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -324,7 +324,7 @@ DEFUN ("execute-kbd-macro", Fexecute_kbd_macro, Sexecute_kbd_macro, 1, 3, 0,
 	    break;
 	}
 
-      command_loop_1 ();
+      command_loop_2 (list1 (Qlite_quit));
 
       executing_kbd_macro_iterations = ++success_count;
 
diff --git a/src/minibuf.c b/src/minibuf.c
index cffb7fe787..9237cbe2b6 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -496,7 +496,7 @@ DEFUN ("abort-minibuffers", Fabort_minibuffers, Sabort_minibuffers, 0, 0, "",
 	}
     }
   else
-    Fthrow (Qexit, Qt);
+    CALLN (Ffuncall, intern ("lite-quit-recursive-edit"));
   return Qnil;
 }
 
-- 
2.31.1


--=-=-=--




Acknowledgement sent to miha@HIDDEN:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#48603; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 25 May 2021 20:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.