From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alexander Shukaev Newsgroups: gmane.emacs.devel Subject: Re: Temporarily disable `timer-event-handler' Date: Tue, 4 Feb 2020 23:30:45 +0100 Message-ID: References: <83wo93hdzh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="69219"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Feb 04 23:34:09 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iz6lk-000HtG-7s for ged-emacs-devel@m.gmane-mx.org; Tue, 04 Feb 2020 23:34:08 +0100 Original-Received: from localhost ([::1]:39180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iz6lj-0005Us-9R for ged-emacs-devel@m.gmane-mx.org; Tue, 04 Feb 2020 17:34:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38620) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iz6kh-0004Xi-LT for emacs-devel@gnu.org; Tue, 04 Feb 2020 17:33:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iz6kg-0001uG-5j for emacs-devel@gnu.org; Tue, 04 Feb 2020 17:33:03 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:42199) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iz6iX-0007kx-PQ; Tue, 04 Feb 2020 17:30:49 -0500 X-Originating-IP: 88.68.139.217 Original-Received: from [192.168.3.109] (dslb-088-068-139-217.088.068.pools.vodafone-ip.de [88.68.139.217]) (Authenticated sender: forum@alexander.shukaev.name) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 1BD5CC0004; Tue, 4 Feb 2020 22:30:45 +0000 (UTC) In-Reply-To: <83wo93hdzh.fsf@gnu.org> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.70.183.198 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:244849 Archived-At: On 03/02/2020 16:44, Eli Zaretskii wrote: > [I removed help-gnu-emacs from the CC list.] > >> From: Stefan Monnier >> Date: Mon, 03 Feb 2020 09:01:47 -0500 >> Cc: help-gnu-emacs@gnu.org, emacs-devel@gnu.org >> >>> Finally, what's the motivation behind this design? This looks fragile and >>> error-prone to run some arbitrary code in the middle of execution of another >>> code without separating their "stacks" (environment scopes), >> >> It's a direct consequence of the implementation, rather than the result >> of design, AFAICT. > > There's also the need to run a timer as close to its expected time as > possible, so waiting for any Lisp to return might delay timers too > much. > Right, the current implementation looks more like coroutines, where certain built-in functions yield for timers to run on occasion. This is indeed likely to be more performent and even useful at times, i.e. example from Stefan > But there can also be cases where A does want/need B to be processed > before A ends. Nonetheless, given the availability of dynamic binding, I find this error-prone. Is there currently a way in Emacs Lisp to run a function within a separate stack, i.e. free of any "user-defined" dynamic bindings? I would imagine that this may be the right solution to fire timer events in this manner as it then does not matter whether they run in the middle of other routines. Additionally, I believe the solution to fulfill > The expectation is that `B' strictly runs after `A' finishes execution. is also missing. Some sort of macro (aka `ignore-timers') which essentially forbids yielding during the execution of the enclosed body, while `let'-binding both `timer-list' and `timer-idle-list' as a naive implementation of such does not really scale, since any inner calls to `cancel-timer' or otherwise scheduling other (new) timer events would have bad side effects. Otherwise, should be something simple and similar to `inhibit-redisplay', aka `inhibit-timers' and `inhibit-idle-timers'.