#include "lisp.h"
#include "dynlib.h"
#include "coding.h"
+#include "keyboard.h"
#include "syssignal.h"
#include <intprops.h>
return ASIZE (lvec);
}
+/* This function should return true if and only if maybe_quit would do
+ anything. */
+static bool
+module_should_quit (emacs_env *env)
+{
+ MODULE_FUNCTION_BEGIN_NO_CATCH (false);
+ return (! NILP (Vquit_flag) && NILP (Vinhibit_quit)) || pending_signals;
+}
+
\f
/* Subroutines. */
eassert (&priv == pub.private_members);
+ /* Process the quit flag first, so that quitting doesn't get
+ overridden by other non-local exits. */
+ maybe_quit ();
+
switch (priv.pending_non_local_exit)
{
case emacs_funcall_exit_return:
env->vec_set = module_vec_set;
env->vec_get = module_vec_get;
env->vec_size = module_vec_size;
+ env->should_quit = module_should_quit;
Vmodule_environments = Fcons (make_save_ptr (env), Vmodule_environments);
}
emacs_value val);
ptrdiff_t (*vec_size) (emacs_env *env, emacs_value vec);
+
+ /* Returns whether a quit is pending. */
+ bool (*should_quit) (emacs_env *env);
};
/* Every module should define a function as follows. */
If quit-flag is set to `kill-emacs' the SIGINT handler has received
a request to exit Emacs when it is safe to do.
- When not quitting, process any pending signals. */
+ When not quitting, process any pending signals.
+
+ If you change this function, also adapt module_should_quit in
+ emacs-module.c. */
void
maybe_quit (void)