Subject: bug#70221: [PATCH] New function `funcall-later`

From: Eli Zaretskii <[email-masked]>
Date: Sat, 06 Apr 2024 09:36:00 +0300

> Date: Fri, 05 Apr 2024 15:56:40 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> +DEFUN ("internal--run-pending-funcalls", Frun_pending_funcalls, Srun_pending_funcalls, 0, 0, 0,
> +       doc: /* Run the still pending `funcall-later'.  */)
> + (void)
> +{
> +  while (CONSP (pending_funcalls) || CONSP (pending_funcalls_r))
> +    if (CONSP (pending_funcalls))
> +      {
> +        Lisp_Object funcall = XCAR (pending_funcalls);
> +        pending_funcalls = XCDR (pending_funcalls);
> +        CALLN (Fapply, funcall);
> +      }
> +    else

You are using CALLN here, whereas the previous implementation used
safe_calln.  Is that intended?  Calling Lisp in unsafe ways in that
place might not be a good idea.  You didn't even inhibit QUIT.

As another difference between run-with-time and this mechanism, the
former took care of preserving deactivate-mark around the call, wheres
funcall-later doesn't -- this is at least one difference that we
should document (assuming we want it).