From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Temporarily disable `timer-event-handler' Date: Tue, 04 Feb 2020 19:53:31 -0500 Message-ID: References: <83wo93hdzh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="126218"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Alexander Shukaev Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Feb 05 01:54:12 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 1iz8xH-000WfQ-U0 for ged-emacs-devel@m.gmane-mx.org; Wed, 05 Feb 2020 01:54:11 +0100 Original-Received: from localhost ([::1]:40112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iz8xH-0005pk-0r for ged-emacs-devel@m.gmane-mx.org; Tue, 04 Feb 2020 19:54:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36800) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iz8wl-0005H5-Ml for emacs-devel@gnu.org; Tue, 04 Feb 2020 19:53:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iz8wk-00032U-09 for emacs-devel@gnu.org; Tue, 04 Feb 2020 19:53:38 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:30737) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iz8wi-0002pD-Bh; Tue, 04 Feb 2020 19:53:36 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5F95544AFA1; Tue, 4 Feb 2020 19:53:35 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B1FCE44AF94; Tue, 4 Feb 2020 19:53:33 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1580864013; bh=aC7EQDiU0oHFqIShu/5DkxAUna8g4vZLyrJmF7dAuKI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=QyJLg1uhTMr28JR1KkzhKBHvmyEJIbFP9EEdUEFRLM35vzrhQOTAfSF5Og70aIgVz jFAvdCQnFzX9tKrlOgDTCyfYopUXJ/YnfBAARzISmszkEaW7B7diX4pX4rZA/y+pmq hrNJ6p0003PEE+9uocblqu04qfrLU9ogEMm/iQ+fZXrFAo9b5sLeS7rE+gelzMlrfZ gS3H1/uyrhoj3JIqJBw9jb4Arg7v9qKL2v6A7NTsuRDEwEuEG/Z4T//5kXfGZTrq77 C0Yq0Mrp119jbdOCV4LwkD3hRWa9cB6LXQyhCLERhsEd6L5V1l3rNqvecNPvqqCdxi 5I5ewihXiUV/g== Original-Received: from pastel (unknown [216.154.34.88]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6AEDE120376; Tue, 4 Feb 2020 19:53:33 -0500 (EST) In-Reply-To: (Alexander Shukaev's message of "Tue, 4 Feb 2020 23:30:45 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 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:244852 Archived-At: >> 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, Yes and no. Until "recently" the answer was clearly no, and now it's kinda possible but not in a really nice way: - using threads (which are not always available, so it can only be used conditionally). - using `backtrace-eval` which will temporarily undo part of the currently installed dynamic bindings (as well as `with-current-buffer`s and `save-excursion`s, IIRC) before evaluating an expression. > Additionally, I believe the solution to fulfill >> The expectation is that `B' strictly runs after `A' finishes execution. > is also missing. Yup! > Some sort of macro (aka `ignore-timers') which essentially > forbids yielding during the execution of the enclosed body, No, remember: Emacs is a Lisp machine, aka a kind of OS, so this would mean that application A hogs the whole machine just because it wants to prevent B from running. Instead we need something more specific which lets A delay B without delaying other, unrelated, events. Stefan