From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wSzfNsELhWDfXwEAgWs5BA (envelope-from ) for ; Sun, 25 Apr 2021 08:27:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id EGquMcELhWBnMAAA1q6Kng (envelope-from ) for ; Sun, 25 Apr 2021 06:27:13 +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 BAC2C1A03F for ; Sun, 25 Apr 2021 08:27:12 +0200 (CEST) Received: from localhost ([::1]:43652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laYEY-0001sN-C6 for larch@yhetil.org; Sun, 25 Apr 2021 02:27:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laYE4-0001sH-JY for emacs-orgmode@gnu.org; Sun, 25 Apr 2021 02:26:40 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:38587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laYE1-0003Lt-NE for emacs-orgmode@gnu.org; Sun, 25 Apr 2021 02:26:40 -0400 Received: by mail-pj1-x1030.google.com with SMTP id f11-20020a17090a638bb02901524d3a3d48so3364144pjj.3 for ; Sat, 24 Apr 2021 23:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=d14S5QOP1zBhCW2geWRoxZJ9qVzD3dy8Z1ES3MHKGEk=; b=W45is2I5KhhbfmvBtbjIpJbnjtTy/r65axB0jTQIxYvKYmCfgsJmspXvUfTtankynf YFdTDfDAU7ny35lmJxXIalAFck30n7HuXi70aUgildH8HKREig5mWPD2Pt10FL/MInb0 InazC0JbEwzaOMYKuMq69Gu8yeh3WmFxX0rPNSUByrvH3pvhHeQtew1VhwTR3wkdF48e lmkfhuzBMnDGTt8OT2poW6HV2m7eQxSlWNZJ6iSMs018Kyb0ZYcFIjYv8XQCpcJw70F9 fshl2Sh3SN3a1ZPlRSHr2Ku0gtNJh63G+6AEyJT3/BSZD6/oD8VXUw5QNLguGNVyJJTq cONg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=d14S5QOP1zBhCW2geWRoxZJ9qVzD3dy8Z1ES3MHKGEk=; b=r1TdaXA5sIxcwfTT2+2M9z30iKwAwpnefwYLei6oRN7ypDv+wX4pgftOiBUX/6OGHe GLsdEmwJXoffX5Ot7xuijGVtBp27Bxe8iOKz+ihnoQDMnCKN1F24EN7KZNFea8i0d5CE X6saXphoRKUlfeBOYdjvK8Tn4txG3GDrR8DXVk3kMnccIFpqyYyQuK1UVkESQ2zWM94T OEquA2v8ucSHXKv1BF1SdsxLtJEOT8S3UPSTPVdnkp9ZUGM+F4kW1x8gR+lNfXs/PlBY ykgNGLjJoeYB+wFEpdlGUHt+w/B/KHUvP1mO4uuGAkoC/2kAMdpWAf2z9rP9BtA688Qk 33rA== X-Gm-Message-State: AOAM531crKbDGcZUAx5bSJY/fC9qn6K0527nvNhdulkzuzdXNATOsaXv qXCsvWIHnEq+8H4WfRiaC7Q= X-Google-Smtp-Source: ABdhPJx/rUZceccP/lvE3VkWCuRRsLHJUPwCxGE/ikvkvTsiHeO3CdeoBvQrk3hQvZPV5Gb3Vn2bhg== X-Received: by 2002:a17:902:7281:b029:ea:afe2:b356 with SMTP id d1-20020a1709027281b02900eaafe2b356mr12543406pll.16.1619331995814; Sat, 24 Apr 2021 23:26:35 -0700 (PDT) Received: from localhost (180-150-91-8.b4965b.per.nbn.aussiebb.net. [180.150.91.8]) by smtp.gmail.com with ESMTPSA id x3sm8497130pfj.95.2021.04.24.23.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Apr 2021 23:26:35 -0700 (PDT) References: <87h7qi2l2m.fsf@gmail.com> <87lfdatkys.fsf@gmail.com> <871rczg7bi.fsf@gmail.com> <87h7lrcxhg.fsf@kyleam.com> User-agent: mu4e 1.4.15; emacs 28.0.50 From: Timothy To: Kyle Meyer Subject: Re: [PATCH] Async session eval (2nd attempt) In-reply-to: <87h7lrcxhg.fsf@kyleam.com> Message-ID: <877dkqx4kn.fsf@gmail.com> Date: Sun, 25 Apr 2021 14:26:32 +0800 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=tecosaur@gmail.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: Jack Kamm , emacs-orgmode@gnu.org 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=1619332032; 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=d14S5QOP1zBhCW2geWRoxZJ9qVzD3dy8Z1ES3MHKGEk=; b=olVlbpsW0av2FlJGZ56AjKaN8yOv9wBkvC9sdVodhXz0gxHfZjUljYj7q81rA19ZwEGv9O bLCWdSEtKmuYekys7pd/X0xZme1K6UaNwWra+LXZi6NvcH3Oqh88gYtNz4l6QlVjX/TvH+ dcNsy4J6v+qLcJM+o+5aAf2m8VqTCZJnOohqMANZ8xkqqiWraH791WZD5zMm8wEeckyyqX vJEcRkJteDXn9tbXlpsipfgjySzsT2ES6OMm2OO2SzGGO+Q6RFRjHqOWIFzO0MbPHkSWZy cfCrPi2V7A4cH570P4g/33ir/Ssw4SUBm+8m6ti3quOFs3v78gp4HISAc9jxxQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619332032; a=rsa-sha256; cv=none; b=uL4ISDsfwd+QwkysFyzcq+h0mG6I3x7LTBCMOtOwFgk2mWRULAVjID0nX+vgDxsCa+5SH2 TsfRZc+xauqzIG2Nml4Py82btT3FyyqzYV5BKf4tjLytoPYcqn+hpgZ+0aMagMDG3mW25I roNlid86UZlkPb030kSqshPcbd8K6vBXP83IW+t4UesE12nMGmNjMR9q3nSFJqbU/O0ToQ GLKjzhvv6Q7z84jTUr6C7n/5QfRMxgKnPvq2weigUjUyYLzVbOpSUhlGQ+4bdf4LoBRmNb vLwx+TOD4NlLlnLztKgyWVi+igLOOlZ5/z8i/GXx2x3C9wcyp7rCgwjL1Ux3WA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=W45is2I5; dmarc=pass (policy=none) header.from=gmail.com; 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: -3.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=W45is2I5; dmarc=pass (policy=none) header.from=gmail.com; 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: BAC2C1A03F X-Spam-Score: -3.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: izs0tv85DNhO Hi Jack, Kyle, This is moving at a glacial pace, but I'd love to see this merged --- there's clearly a lot of interest in this from the community if not within this mailing list (ob-async which is more limited has 250 stars on GitHub). Jack, do you think you might be able to make these tweaks so I can implore the maintainers to "just merge this"? :P Kyle, if Jack doesn't get back to us do you think we could just make those changes and merge the patch as-is at some point? Or merge it and then add a commit making these fixes? -- Timothy. Kyle Meyer writes: > 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.