aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorMiha Rihtaršič2021-09-20 07:59:29 +0200
committerLars Ingebrigtsen2021-09-20 07:59:29 +0200
commit31ba9bbf6c2d0a265c77de1c068400b750ecf34b (patch)
tree2ff04f3e3e9ff3b801f463f33c0671586b69475c /src/eval.c
parent995a623594de27d398f0d97fcab9277e37fe29d1 (diff)
downloademacs-31ba9bbf6c2d0a265c77de1c068400b750ecf34b.tar.gz
emacs-31ba9bbf6c2d0a265c77de1c068400b750ecf34b.zip
Refactor minibuffer aborting
* lisp/minibuffer.el (minibuffer-quit-recursive-edit): New optional argument to specify how many levels of recursion to quit. * src/eval.c (internal_catch): Remove special handling of 'exit tag (bug#49700). * src/minibuf.c (Fabort_minibuffers): Use minibuffer-quit-recursive-edit to quit multiple levels of minibuffer recursion.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/src/eval.c b/src/eval.c
index 48104bd0f45..76fe671b6dd 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1174,14 +1174,6 @@ usage: (catch TAG BODY...) */)
1174 FUNC should return a Lisp_Object. 1174 FUNC should return a Lisp_Object.
1175 This is how catches are done from within C code. */ 1175 This is how catches are done from within C code. */
1176 1176
1177/* MINIBUFFER_QUIT_LEVEL is to handle quitting from nested minibuffers by
1178 throwing t to tag `exit'.
1179 0 means there is no (throw 'exit t) in progress, or it wasn't from
1180 a minibuffer which isn't the most nested;
1181 N > 0 means the `throw' was done from the minibuffer at level N which
1182 wasn't the most nested. */
1183EMACS_INT minibuffer_quit_level = 0;
1184
1185Lisp_Object 1177Lisp_Object
1186internal_catch (Lisp_Object tag, 1178internal_catch (Lisp_Object tag,
1187 Lisp_Object (*func) (Lisp_Object), Lisp_Object arg) 1179 Lisp_Object (*func) (Lisp_Object), Lisp_Object arg)
@@ -1189,9 +1181,6 @@ internal_catch (Lisp_Object tag,
1189 /* This structure is made part of the chain `catchlist'. */ 1181 /* This structure is made part of the chain `catchlist'. */
1190 struct handler *c = push_handler (tag, CATCHER); 1182 struct handler *c = push_handler (tag, CATCHER);
1191 1183
1192 if (EQ (tag, Qexit))
1193 minibuffer_quit_level = 0;
1194
1195 /* Call FUNC. */ 1184 /* Call FUNC. */
1196 if (! sys_setjmp (c->jmp)) 1185 if (! sys_setjmp (c->jmp))
1197 { 1186 {
@@ -1205,17 +1194,6 @@ internal_catch (Lisp_Object tag,
1205 Lisp_Object val = handlerlist->val; 1194 Lisp_Object val = handlerlist->val;
1206 clobbered_eassert (handlerlist == c); 1195 clobbered_eassert (handlerlist == c);
1207 handlerlist = handlerlist->next; 1196 handlerlist = handlerlist->next;
1208 if (EQ (tag, Qexit) && EQ (val, Qt) && minibuffer_quit_level > 0)
1209 /* If we've thrown t to tag `exit' from within a minibuffer, we
1210 exit all minibuffers more deeply nested than the current
1211 one. */
1212 {
1213 if (minibuf_level > minibuffer_quit_level
1214 && !NILP (Fminibuffer_innermost_command_loop_p (Qnil)))
1215 Fthrow (Qexit, Qt);
1216 else
1217 minibuffer_quit_level = 0;
1218 }
1219 return val; 1197 return val;
1220 } 1198 }
1221} 1199}