From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id kHIGEKJsQGAtLQAA0tVLHw (envelope-from ) for ; Thu, 04 Mar 2021 05:14:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id QCW3C6JsQGDyKgAAbx9fmQ (envelope-from ) for ; Thu, 04 Mar 2021 05:14:10 +0000 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 38D8B11677 for ; Thu, 4 Mar 2021 06:14:09 +0100 (CET) Received: from localhost ([::1]:33428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHgJL-0007Om-Cv for larch@yhetil.org; Thu, 04 Mar 2021 00:14:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHgIz-0007Oa-E5 for emacs-orgmode@gnu.org; Thu, 04 Mar 2021 00:13:45 -0500 Received: from out1.migadu.com ([91.121.223.63]:30024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHgIv-0006f7-Lk for emacs-orgmode@gnu.org; Thu, 04 Mar 2021 00:13:45 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1614834818; h=from:from: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; bh=Zab9V1xlCAHAZdixNdyaE+/fGCtdmqecatZf1W+3mM4=; b=sDg+M4snHzPAns3i+9Z1GZ8IsaaUPx0bnA1wMpm+Y+KF4OVDrFV0gMvftknfUAEi1QCQNM HiADCseJqQpNEedobv8V9O+PrSmiWygS7pkmeFUVzc0ezzvGB2OWBuvqN58//ipK85CHss b4CadoMd5mt8MqodGjUT8T8YJPZfM+DDQy7fd4a3OKICTHyQ0yPMvwlwwTT91C4aIaLDgF LGURR2rZSi6F32NnsLY3Yn0Q+BvFR1Nd1cexR+OyJFycpMzd8stGtQkokAReoklRtrROw5 MlXR2Jo3m1HUWHLTl0BVmAlB5reZs77q6KTxjDQcfv53i692gB/2zzKQ2FPSLg== From: Kyle Meyer To: Jack Kamm Subject: Re: [PATCH] Async session eval (2nd attempt) In-Reply-To: <871rczg7bi.fsf@gmail.com> References: <87h7qi2l2m.fsf@gmail.com> <87lfdatkys.fsf@gmail.com> <871rczg7bi.fsf@gmail.com> Date: Thu, 04 Mar 2021 00:13:31 -0500 Message-ID: <87h7lrcxhg.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Auth-User: kyle@kyleam.com Received-SPF: pass client-ip=91.121.223.63; envelope-from=kyle@kyleam.com; helo=out1.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org, TEC Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1614834850; 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=Zab9V1xlCAHAZdixNdyaE+/fGCtdmqecatZf1W+3mM4=; b=NRHtESAku8cYJiy2/GJV+HcJ2uRKg52HlHRBSfyuk8rlGFircW4fcFmQKrmincLDfw95te yLtvYsxTRXsvScxOIjB0WUoyNUUJFb0QkPXhhLO1NLVbGQA187C6qhGsyETCPOF8M0hfnd zIZO4ti4LbP5H8VmUi1IKHQvlNQqW7e+92HMkV8Dfm6JwpX34eKyHGCnWnoQPCO3UxowLu O6ikXal6uvTYdLR7rfGwHzf7OEDP6uKrM5yfQqm3RWVfXqOFw/QLlYla3joaIfRSzJ6sxE jMxrGfmBwevju5kxDmpFCywkOAyLLDEUmlSLz/5o3eW3aTKjA5wok/Yp+Fx8GA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1614834850; a=rsa-sha256; cv=none; b=jJxlAYMyljTQHMx5VPYGYmGqCXWbAXtBKPpIpLYXwkSRhs2yeI6uZEzCPcpdVpu8TF3Vp7 MIU6HUzxcAJTy/UBuHUjPkZfDlYKo4oJXCNPskFT8t11HxYZYoKXP4lze1HMMYCd4bPRJ2 hm6ckmnv/4/LXDm3+oMHfNxQyKwnOlleStqBR1SVKcAo3qPR3FKQEBHBl77+zNR+oHPds1 25ytWMSLf1JUQPuloX8IrF5Rq4tI7NdnyMgoHMtoa9zY/ns2FrzujTKEEWmvC4JvKD5CPd ccooTJdBoWhAEH82vzKKOlPAnoExnPU9jas46bs3DsCchRbvyI25an+BfgHCDQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=kyleam.com header.s=key1 header.b=sDg+M4sn; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.36 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=kyleam.com header.s=key1 header.b=sDg+M4sn; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 38D8B11677 X-Spam-Score: -1.36 X-Migadu-Scanner: scn0.migadu.com X-TUID: mpMBYV0yXndQ Jack Kamm writes: > I also have an async implementation for ob-R that's ready after this is > merged :) It's a bit disappointing that only one babel user has tested this out and provided feedback, but please feel free to merge this whenever you think it's ready. I'm very happy to leave the babel details to you, but here are minor comments from a quick read-through looking for things that will likely be changed/cleaned up (either in the Org repo or the Emacs repo) if left as is. > Subject: [PATCH] ob-comint.el, ob-python.el: Async session evaluation [...] > +;; Async evaluation For a heading comment, please use at least three semicolons. (info "(elisp)Comment Tips") > + > +(defvar-local org-babel-comint-async-indicator nil > + "Regular expression that `org-babel-comint-async-filter' scans for. > +It should have 2 parenthesized expressions, > +e.g. \"org_babel_async_\\(start\\|end\\|file\\)_\\(.*\\)\". The > +first parenthesized expression determines whether the token is > +delimiting a result block, or whether the result is in a file. If > +delimiting a block, the second expression gives a UUID for the > +location to insert the result. Otherwise, the result is in a tmp > +file, and the second expression gives the file name.") > + > +(defvar-local org-babel-comint-async-buffers nil > + "List of org-mode buffers to check for Babel async output results.") s/org-mode/Org mode/ here and other spots, following doc/Documentation_Standards.org and tree-wide cleanups like de24694f0 (Turn org-mode into Org or Org mode, 2016-08-23). Also, you're missing two spaces between some sentences. > +(defmacro org-babel-comint-async-delete-dangling-and-eval > + (session-buffer &rest body) > + "Remove dangling text in SESSION-BUFFER and evaluate BODY. > +This is analogous to `org-babel-comint-with-output', but meant > +for asynchronous output, and much shorter because inserting the > +result is delegated to `org-babel-comint-async-filter'." > + (declare (indent 1)) > + `(org-babel-comint-in-buffer ,session-buffer > + (goto-char (process-mark (get-buffer-process (current-buffer)))) > + (delete-region (point) (point-max)) > + ,@body)) > +(def-edebug-spec org-babel-comint-async-with-output (sexp body)) Please move this edebug spec to the `declare' form (see 7dd1cfb6c, 2021-02-12). > diff --git a/testing/lisp/test-ob-python.el b/testing/lisp/test-ob-python.el > index a2cc7b79c..0267678cd 100644 > --- a/testing/lisp/test-ob-python.el > +++ b/testing/lisp/test-ob-python.el > @@ -207,6 +207,67 @@ (ert-deftest test-ob-python/session-value-sleep () > #+end_src" > (org-babel-execute-src-block))))) > > +(ert-deftest test-ob-python/async-simple-session-output () > + (let ((org-babel-temporary-directory "/tmp") Prefer `temporary-file-directory' to hard coding "/tmp". Thanks.