aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorPhilipp Stephani2019-01-02 22:04:56 +0100
committerPhilipp Stephani2019-02-24 22:43:07 +0100
commit72ec233f2a1b8a6a9574e61588d0467caf41755c (patch)
tree725add4413feb9cb7789576294099096e63d3044 /doc/lispref
parent5653b76d0bacf1edfc3d962c0bb991344cd80f6f (diff)
downloademacs-72ec233f2a1b8a6a9574e61588d0467caf41755c.tar.gz
emacs-72ec233f2a1b8a6a9574e61588d0467caf41755c.zip
Ignore pending_signals when checking for quits.
pending_signals is often set if no quit is pending. This results in bugs in module code if the module returns but no quit is actually pending. As a better alternative, add a new process_input environment function for Emacs 27. That function processes signals (like maybe_quit). * configure.ac: Add module snippet for Emacs 27. * src/module-env-27.h: New file. * src/emacs-module.h.in: Add process_input function to environment interface. * src/emacs-module.c (module_should_quit): Use QUITP macro to check whether the caller should quit. (module_process_input): New function. (initialize_environment): Use it. * src/eval.c: Remove obsolete comment. * test/data/emacs-module/mod-test.c (signal_wrong_type_argument) (signal_errno): New helper functions. (Fmod_test_sleep_until): New test module function. * test/src/emacs-module-tests.el (mod-test-sleep-until): New unit test. * doc/lispref/internals.texi (Module Misc): Document process_input.
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/internals.texi22
1 files changed, 21 insertions, 1 deletions
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 3fbff266add..56465126f41 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -1623,7 +1623,27 @@ purpose.
1623@deftypefn Function bool should_quit (emacs_env *@var{env}) 1623@deftypefn Function bool should_quit (emacs_env *@var{env})
1624This function returns @code{true} if the user wants to quit. In that 1624This function returns @code{true} if the user wants to quit. In that
1625case, we recommend that your module function aborts any on-going 1625case, we recommend that your module function aborts any on-going
1626processing and returns as soon as possible. 1626processing and returns as soon as possible. In most cases, use
1627@code{process_input} instead.
1628@end deftypefn
1629
1630To process input events in addition to checking whether the user wants
1631to quit, use the following function, which is available since Emacs
163227.1.
1633
1634@anchor{process_input}
1635@deftypefn Function enum emacs_process_input_result process_input (emacs_env *@var{env})
1636This function processes pending input events. It returns
1637@code{emacs_process_input_quit} if the user wants to quit or an error
1638occurred while processing signals. In that case, we recommend that
1639your module function aborts any on-going processing and returns as
1640soon as possible. If the module code may continue running,
1641@code{process_input} returns @code{emacs_process_input_continue}. The
1642return value is @code{emacs_process_input_continue} if and only if
1643there is no pending nonlocal exit in @code{env}. If the module
1644continues after calling @code{process_input}, global state such as
1645variable values and buffer content may have been modified in arbitrary
1646ways.
1627@end deftypefn 1647@end deftypefn
1628 1648
1629@node Module Nonlocal 1649@node Module Nonlocal