aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorAndrea Corallo2021-02-17 22:26:28 +0100
committerAndrea Corallo2021-02-17 22:26:28 +0100
commitf92bb788a073c6b3ca7f188e0edea714598193fd (patch)
tree9bea27955098bfc33d0daaa345cfa3dca5b695fd /src/eval.c
parent1fe5994bcb8b58012dbba0a5f7d03138c293286f (diff)
parent6735bb3d22dc64f3fe42e4a7f439ea9d62f75b5a (diff)
downloademacs-f92bb788a073c6b3ca7f188e0edea714598193fd.tar.gz
emacs-f92bb788a073c6b3ca7f188e0edea714598193fd.zip
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/eval.c b/src/eval.c
index bf5f6995d87..10e53cf9aed 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1174,21 +1174,23 @@ 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
1177Lisp_Object 1185Lisp_Object
1178internal_catch (Lisp_Object tag, 1186internal_catch (Lisp_Object tag,
1179 Lisp_Object (*func) (Lisp_Object), Lisp_Object arg) 1187 Lisp_Object (*func) (Lisp_Object), Lisp_Object arg)
1180{ 1188{
1181 /* MINIBUFFER_QUIT_LEVEL is to handle quitting from nested minibuffers by
1182 throwing t to tag `exit'.
1183 Value -1 means there is no (throw 'exit t) in progress;
1184 0 means the `throw' wasn't done from an active minibuffer;
1185 N > 0 means the `throw' was done from the minibuffer at level N. */
1186 static EMACS_INT minibuffer_quit_level = -1;
1187 /* This structure is made part of the chain `catchlist'. */ 1189 /* This structure is made part of the chain `catchlist'. */
1188 struct handler *c = push_handler (tag, CATCHER); 1190 struct handler *c = push_handler (tag, CATCHER);
1189 1191
1190 if (EQ (tag, Qexit)) 1192 if (EQ (tag, Qexit))
1191 minibuffer_quit_level = -1; 1193 minibuffer_quit_level = 0;
1192 1194
1193 /* Call FUNC. */ 1195 /* Call FUNC. */
1194 if (! sys_setjmp (c->jmp)) 1196 if (! sys_setjmp (c->jmp))
@@ -1203,22 +1205,16 @@ internal_catch (Lisp_Object tag,
1203 Lisp_Object val = handlerlist->val; 1205 Lisp_Object val = handlerlist->val;
1204 clobbered_eassert (handlerlist == c); 1206 clobbered_eassert (handlerlist == c);
1205 handlerlist = handlerlist->next; 1207 handlerlist = handlerlist->next;
1206 if (EQ (tag, Qexit) && EQ (val, Qt)) 1208 if (EQ (tag, Qexit) && EQ (val, Qt) && minibuffer_quit_level > 0)
1207 /* If we've thrown t to tag `exit' from within a minibuffer, we 1209 /* If we've thrown t to tag `exit' from within a minibuffer, we
1208 exit all minibuffers more deeply nested than the current 1210 exit all minibuffers more deeply nested than the current
1209 one. */ 1211 one. */
1210 { 1212 {
1211 EMACS_INT mini_depth = this_minibuffer_depth (Qnil); 1213 if (minibuf_level > minibuffer_quit_level
1212 if (mini_depth && mini_depth != minibuffer_quit_level) 1214 && !NILP (Fminibuffer_innermost_command_loop_p (Qnil)))
1213 { 1215 Fthrow (Qexit, Qt);
1214 if (minibuffer_quit_level == -1)
1215 minibuffer_quit_level = mini_depth;
1216 if (minibuffer_quit_level
1217 && (minibuf_level > minibuffer_quit_level))
1218 Fthrow (Qexit, Qt);
1219 }
1220 else 1216 else
1221 minibuffer_quit_level = -1; 1217 minibuffer_quit_level = 0;
1222 } 1218 }
1223 return val; 1219 return val;
1224 } 1220 }
@@ -2177,14 +2173,21 @@ then strings and vectors are not accepted. */)
2177DEFUN ("autoload", Fautoload, Sautoload, 2, 5, 0, 2173DEFUN ("autoload", Fautoload, Sautoload, 2, 5, 0,
2178 doc: /* Define FUNCTION to autoload from FILE. 2174 doc: /* Define FUNCTION to autoload from FILE.
2179FUNCTION is a symbol; FILE is a file name string to pass to `load'. 2175FUNCTION is a symbol; FILE is a file name string to pass to `load'.
2176
2180Third arg DOCSTRING is documentation for the function. 2177Third arg DOCSTRING is documentation for the function.
2181Fourth arg INTERACTIVE if non-nil says function can be called interactively. 2178
2179Fourth arg INTERACTIVE if non-nil says function can be called
2180interactively. If INTERACTIVE is a list, it is interpreted as a list
2181of modes the function is applicable for.
2182
2182Fifth arg TYPE indicates the type of the object: 2183Fifth arg TYPE indicates the type of the object:
2183 nil or omitted says FUNCTION is a function, 2184 nil or omitted says FUNCTION is a function,
2184 `keymap' says FUNCTION is really a keymap, and 2185 `keymap' says FUNCTION is really a keymap, and
2185 `macro' or t says FUNCTION is really a macro. 2186 `macro' or t says FUNCTION is really a macro.
2187
2186Third through fifth args give info about the real definition. 2188Third through fifth args give info about the real definition.
2187They default to nil. 2189They default to nil.
2190
2188If FUNCTION is already defined other than as an autoload, 2191If FUNCTION is already defined other than as an autoload,
2189this does nothing and returns nil. */) 2192this does nothing and returns nil. */)
2190 (Lisp_Object function, Lisp_Object file, Lisp_Object docstring, Lisp_Object interactive, Lisp_Object type) 2193 (Lisp_Object function, Lisp_Object file, Lisp_Object docstring, Lisp_Object interactive, Lisp_Object type)