unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Modules: should_quit vs. process_input in Emacs 27
@ 2019-07-22 21:25 Hans-Peter Deifel
  2019-07-23 14:52 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Hans-Peter Deifel @ 2019-07-22 21:25 UTC (permalink / raw)
  To: emacs-devel

Hello Emacs hackers,

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?

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

Cheers,
HP



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Modules: should_quit vs. process_input in Emacs 27
  2019-07-22 21:25 Modules: should_quit vs. process_input in Emacs 27 Hans-Peter Deifel
@ 2019-07-23 14:52 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2019-07-23 14:52 UTC (permalink / raw)
  To: Hans-Peter Deifel; +Cc: emacs-devel

> From: Hans-Peter Deifel <hpd@hpdeifel.de>
> 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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-23 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-22 21:25 Modules: should_quit vs. process_input in Emacs 27 Hans-Peter Deifel
2019-07-23 14:52 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).