[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Modules: should_quit vs. process_input in Emacs 27
From: |
Eli Zaretskii |
Subject: |
Re: Modules: should_quit vs. process_input in Emacs 27 |
Date: |
Tue, 23 Jul 2019 17:52:10 +0300 |
> From: Hans-Peter Deifel <address@hidden>
> Date: Mon, 22 Jul 2019 23:25:33 +0200
>
> I'm writing a dynamic module in C that includes a long-running
> computation. It uses `should_quit' as per the documentation to check
> from time to time if the user wants to quit, in which case the
> computation is immediately aborted. This works great on Emacs 26.2, but
> doesn't on master: The computation just keeps on computing, no matter
> how often the user presses C-g.
>
> The git log and the info manual in master mention the new environment
> function `process_inputs' that should be used instead of `should_quit'.
> This does indeed work, but now the module is no longer compatible with
> Emacs 26.
>
> What should module authors in this case do to keep their modules
> compatible with older Emacs versions? Conditional compilation?
Not conditional compilation; dynamic discovery of the Emacs version in
which the module is running. How to do that is described in the
"Module Initialization" node of the ELisp manual.
> Also, what's the purpose of the current `should_quit' in master, if it
> doesn't work for the above use-case any more. Why doesn't it simply
> behave like the following?
>
> process_input (env) == emacs_process_input_quit
AFAIR, because process_input processes pending input events.
Sometimes you may wish not to do that.