From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id OE1TO/isw2UhLAAAe85BDQ:P1 (envelope-from ) for ; Wed, 07 Feb 2024 17:16:57 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id OE1TO/isw2UhLAAAe85BDQ (envelope-from ) for ; Wed, 07 Feb 2024 17:16:57 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=GA97SKaA; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707322616; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=IujAHQ0wzqTMwbJT6r8hns/Ll0VveMdbG+AvZRLsRrE=; b=B1lcauR+023t+zrXVMCxSM4gu0WM8i46DEsI4xXj2ccmo0sQRhDZwGdJcmQjHFUHZTEEZs gGtZCidlqSdV5TTA4S2TIAZOHr0TT7i3bzG8a35RafEcaC448ZYUeV9nNEZi0MCFfBhW0d hRDO0BMB9b66nZO4rLucBK1juWPbyQeABDZqkyHgtfRAnLyzNoHpgWhAEewfAy9vd1QqYe 1hfRCPyShAn2gswTGJxiUGkqF52ULIlr/2I0/jw6lFX2AAwcfyouhCesxDjdpw6l48vetV RypFZTgPTv75z6XrbJvahWrS4+xJI9/juoKR2dcZJcjQi3Iub20RYU0P7z1oJg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=GA97SKaA; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707322616; a=rsa-sha256; cv=none; b=bgM+VDJG7XZccA793mYGhvfdLekL2Xp7dtLMUFG/Yx4JMZWFQm1+CpOjjmR+wyNz6zLB+Y 9rXDRGoZ5PKOpJI8sp57y3Eo6bSCdfxwz8NlFjHWVYvjoyUbq2SYKKmk3hQ4fkjjYGTP78 cU37PKVkjb96r7Kd0eBCiXiI12mWr46bsW1oMDmbbPqs1sWFwPwnYrN+lJpVQif9xyp4Ht SWTfsVywHDxb71AoAo5hJSfF3Gf2SyG4+n2tWzJarthcStfMOAVjwb3RIDTg+G3MGnFP7C lrfgOwY7zyX41MOdClITWdJIDNoZ6zs5jp+Zx6wJEpppRIp8s7Pjpxy1pdrpXw== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BD92A5A2E3 for ; Wed, 7 Feb 2024 17:16:56 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXkap-0001zJ-Bv; Wed, 07 Feb 2024 11:16:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXkan-0001yT-Lm for emacs-orgmode@gnu.org; Wed, 07 Feb 2024 11:16:09 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXkak-0001wV-LP for emacs-orgmode@gnu.org; Wed, 07 Feb 2024 11:16:09 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 592B6240101 for ; Wed, 7 Feb 2024 17:16:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707322563; bh=KDJvtxOtkKZsxhcr+GYbkG9skDi78+eWtm/fiJ4JvrM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=GA97SKaAozuGbqxkkUotjn3C0Ksn8Hc+HqRmc5DJ1ZlnegVZV5j+QlfNffFRkzq7D 9Ph6dw3zDQC0GZcE9jVRKszFWyUWUajq5NsfCaTauANoASLlXwtjrUfyJr+yHOC85Y T2DYEdm/Wb0HF8sj2HxNMpnCAh3cff9bfQnRQO/usOcoTIW/RcAanJL52Rzdl2abih ZgmvXtbdOkngLE2mBrXOMeJHVPRhrkYh2jCANNYXz0U3N+8ri/EhoI+hV6IKAQtNJQ ifi3aNPi51RwXyYkHmhfLzqYW9rQJji+iODNIAVge7/eInwA3EMcR2MXtUk7qS5hBM Ur2nfHbOXQRIA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TVQGB4H7Pz9rxG; Wed, 7 Feb 2024 17:16:02 +0100 (CET) From: Ihor Radchenko To: Bruno Barbier Cc: Jack Kamm , emacs-orgmode@gnu.org Subject: Re: [BUG] Unexpected result when evaluating python src block asynchronously [9.7-pre (release_9.6.17-1131-gc9ed03.dirty @ /home/yantar92/.emacs.d/straight/build/org/)] In-Reply-To: <65c2875f.050a0220.caf6d.8291@mx.google.com> References: <87o7d0mm54.fsf@localhost> <65bbb108.050a0220.b60fd.6790@mx.google.com> <87jznm8hcu.fsf@gmail.com> <875xz42rp9.fsf@localhost> <874jen8zec.fsf@gmail.com> <87o7cv9e80.fsf@localhost> <65c2875f.050a0220.caf6d.8291@mx.google.com> Date: Wed, 07 Feb 2024 16:19:32 +0000 Message-ID: <87v870qmaz.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.97 X-Migadu-Queue-Id: BD92A5A2E3 X-Spam-Score: -6.97 X-Migadu-Scanner: mx11.migadu.com X-TUID: DG7eNYAPCuIN Bruno Barbier writes: > FWIW, I've been trying to use asynchronous blocks for everything, not > only the source blocks that are based on the comint mode. I think it > would be good if ob-core itself could provide an asynchronous API. I've > modified my Org so that it does have such an API. This is work in > progress; let me describe it. > > I've modified ob-core itself to allow asynchronicity. In the > asynchrosous case, instead of calling: > > (org-babel-execute:LANG body params) > > I'm calling: > > (org-babel-schedule:LANG body params handle-result) > > where `org-babel-schedule:LANG' is in charge of calling `handle-result' > with the result (or the error) when it is known; `handle-result' takes > care to call `org-babel-insert-result' at the correct place (and > `org-babel-insert-result' is only called with a real result). LGTM. > While the execution is pending, I'm using the same technique that Org is > using when a source block is being edited: the result is left untouched, > but below an overlay. The overlay is used to know where to insert the > result and to display the status/progress of the execution. If the file > is closed and the execution fails, nothing is lost, the old result is > still available. > > If that technique looks safe enough and interesting, I can prepare a set > of patches so that we can discuss it further and, maybe, add it in Org. Using overlay also sounds good. I am wondering what you do when there is no result yet or when user edits whatever is under the overlay, but that's just a technical detail. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at