From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp10.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms9.migadu.com with LMTPS
	id 4NuGEvpWImSZ+wAASxT56A
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 28 Mar 2023 04:54:50 +0200
Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp10.migadu.com with LMTPS
	id IFi8EfpWImSyHwAAG6o9tA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 28 Mar 2023 04:54:50 +0200
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 12FEC29250
	for <larch@yhetil.org>; Tue, 28 Mar 2023 04:54:49 +0200 (CEST)
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=excalamus.com header.s=zmail header.b=Xmsh7Lgt;
	arc=pass ("zohomail.com:s=zohoarc:i=1");
	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=none
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1679972090;
	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=SOvKbRfKDQj7MCrwEDYxCbjLqMTNmxHfD8bEKGpFnAM=;
	b=BHR1TqY0nIFVS5nFEuLelA17A5XgX1h3w/kWbdQD+rpbiPWUXhijrLeUyyBKFzmFcACDtx
	ZHG1gtbqtfacEDtrmxL3aqROwfMoowjKwC1UBLmel+fcY10nV1pGgcbGsDAuVacr+ab58K
	3M9IwmuwOvjESJVDLCMFJz9IPp4swNr7bRAAHPITzgi/5SdFUk88ctMa590U8u1KbUH3lO
	uQ/WDNOlAohzFNkt72jbX13fNvoBUoC6zHo1t3+hVSmY8oFVjYZ7GXVjWy1orRGtt8S4tR
	Tj14+blPW8aXmAOy/zj7+b85vKHUDPkop3by2hX0uXavhrfSfr6V8leuvBCqXg==
ARC-Seal: i=2; s=key1; d=yhetil.org; t=1679972090; a=rsa-sha256; cv=pass;
	b=DCeKd3KZ5BG0OHLNz3PJ9/OoM+bMZCgXjlIkODyPaG0SGt549apX5bsltjo1DUygEwNkqL
	naURMMytJ/FqCXpOxijzLHF5qmaEfe4ZY188P0r29Ppv/Wg82BDITmPOQ2+E9KR5FPdlnB
	O7LeXezdcQYgRMMH6uts4vnlmfPpLmWJNeaSMQK4zqQcjexhL59kWBkvW8x8Zq+BCWiowp
	RtyOTBvxvJN1IH51VqPLni3kzGeWdgmmWVH9fre/mnl5bozsssxBaHiPjtat8hgi1scSim
	MB3Btxx9QM7YUG+p9dDrYKcN+Ro1Lz3vLAz3YemKH0zgkl3v8b48Su1SZPioWA==
ARC-Authentication-Results: i=2;
	aspmx1.migadu.com;
	dkim=pass header.d=excalamus.com header.s=zmail header.b=Xmsh7Lgt;
	arc=pass ("zohomail.com:s=zohoarc:i=1");
	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=none
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces@gnu.org>)
	id 1pgzTG-00054R-1t; Mon, 27 Mar 2023 22:54:02 -0400
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 <matt@excalamus.com>)
 id 1pgzTE-00054I-Ao
 for emacs-orgmode@gnu.org; Mon, 27 Mar 2023 22:54:00 -0400
Received: from sender4-op-o15.zoho.com ([136.143.188.15])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <matt@excalamus.com>)
 id 1pgzTC-0002Wp-JQ
 for emacs-orgmode@gnu.org; Mon, 27 Mar 2023 22:53:59 -0400
ARC-Seal: i=1; a=rsa-sha256; t=1679972035; cv=none; 
 d=zohomail.com; s=zohoarc; 
 b=ZPXqTZkXtIzuJEafMLFj4z3IaoRtsAVopJNPnJP5IRowNtW8oIAUfQGxNED2z1jkqbup/gMg1OT5+zjXi6SyGGSO5QrhEzr57FqXQu21mjFQL1MC+0TOdbiHGvIELeOHAA7787pvp7L1jV/zeD2KXtrab12BS0/PvrwaZUZBjik=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc; t=1679972035;
 h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To;
 bh=SOvKbRfKDQj7MCrwEDYxCbjLqMTNmxHfD8bEKGpFnAM=; 
 b=lJ115YPDJw1AsflcstHt7MB1/fvIfYWnkaQciJGcauYC1MtQQII6PJ5bvcuPyW5mXAzw563M4dD03/35zjqZ9kuhGV1hl/TLf/mBD0gSkMv6/JVrRTCB4CcpVyFvEc4NXS19da+Bzxd7/A1vWNdUv+BFjut1alE0GH9oB8S/kTM=
ARC-Authentication-Results: i=1; mx.zohomail.com;
 dkim=pass  header.i=excalamus.com;
 spf=pass  smtp.mailfrom=matt@excalamus.com;
 dmarc=pass header.from=<matt@excalamus.com>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1679972035; 
 s=zmail; d=excalamus.com; i=matt@excalamus.com;
 h=Date:Date:From:From:To:To:Cc:Cc:Message-Id:Message-Id:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Reply-To;
 bh=SOvKbRfKDQj7MCrwEDYxCbjLqMTNmxHfD8bEKGpFnAM=;
 b=Xmsh7LgtW5C/TE5lAGwuFgAP/khQD3+qM/vDOd+LRUga4Zaubu1X07PHWwBS9+o3
 Cngr28kTmpb+oX/KNLaMk+glcntuNlRQjMCgUDtCo4SvF7stBSyCd3odXUG1kj4jvom
 vxiNjduqFk2bQN+5mrBCdUwUr8X06mJGdjLwaHsc=
Received: from mail.zoho.com by mx.zohomail.com
 with SMTP id 1679972032479303.6771599703069;
 Mon, 27 Mar 2023 19:53:52 -0700 (PDT)
Date: Mon, 27 Mar 2023 22:53:52 -0400
From: Matt <matt@excalamus.com>
To: "Ihor Radchenko" <yantar92@posteo.net>
Cc: "emacs-orgmode" <emacs-orgmode@gnu.org>
Message-Id: <1872622dfc3.bc166abd104246.2200427223545260563@excalamus.com>
In-Reply-To: <87ttyay0jl.fsf@localhost>
References: <186283d230a.129f5feb61660123.3289004102603503414@excalamus.com>
 <87fsbcbf47.fsf@localhost>
 <186471d8980.c36aecd0374444.2548279362371712281@excalamus.com>
 <87sff73r0g.fsf@localhost>
 <18658639a30.dec640641420614.2364646537016397698@excalamus.com>
 <87lekwd10z.fsf@localhost>
 <1866bf50874.bc4ef1a92164564.1238825567948423531@excalamus.com>
 <87r0ukefzv.fsf@localhost>
 <1866fda933d.cf33745c2396994.7118762013608820270@excalamus.com>
 <87sfeyc7qr.fsf@localhost>
 <1869ff63e3e.f8c4ed671354538.4585567073216319262@excalamus.com>
 <87bkl96g6e.fsf@localhost>
 <186a89b5a24.cc4913fe1885630.21323979015166045@excalamus.com>
 <87ilffz95g.fsf@localhost>
 <186b5aa9d56.1238923db2169250.3173443400140454866@excalamus.com>
 <87ttywg26t.fsf@localhost>
 <186c771ebdb.fadb25d63466542.8590370552765842508@excalamus.com>
 <873562z66c.fsf@localhost>
 <18705dca9b8.f4f7e70c165671.6021704484862511260@excalamus.com>
 <87bkkjn0ub.fsf@localhost>
 <1870ff849df.d1dd8428801951.6882979561396816717@excalamus.com>
 <87ttyay0jl.fsf@localhost>
Subject: Re: [PATCH] Async evaluation in ob-shell
MIME-Version: 1.0
Content-Type: multipart/mixed; 
 boundary="----=_Part_325912_512302212.1679972032451"
Importance: Medium
User-Agent: Zoho Mail
X-Mailer: Zoho Mail
X-Zoho-Virus-Status: 1
Received-SPF: pass client-ip=136.143.188.15; envelope-from=matt@excalamus.com;
 helo=sender4-op-o15.zoho.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,
 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.29
Precedence: list
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
X-Migadu-Queue-Id: 12FEC29250
X-Spam-Score: -10.44
X-Migadu-Spam-Score: -10.44
X-Migadu-Scanner: scn0.migadu.com
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
X-Migadu-Country: US
X-Migadu-Flow: FLOW_IN
X-TUID: 752HA9BEC7Z7

------=_Part_325912_512302212.1679972032451
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit


 ---- On Fri, 24 Mar 2023 05:13:34 -0400  Ihor Radchenko  wrote --- 

 > A small note on the WORG page: it may be more natural to use :async yes
 > rather than :async t. Both are viable - in fact, anything other than
 > :async no and :async none will be treated as "t".
 
Ah, okay.  I'll make that more clear.

Somewhat related, I had this left over from when I was working out the async code.  It prevents the user from running :async without the (required) :session header.    The :async header runs the default (blocking) process when :session is missing.

diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el
index 86c2bf7a7..384bfcda8 100644
--- a/lisp/ob-comint.el
+++ b/lisp/ob-comint.el
@@ -206,11 +206,12 @@ comint outputs due to buffering.")
 PARAMS are the header arguments as passed to
 `org-babel-execute:lang'."
   (let ((async (assq :async params))
-        (session (assq :session params)))
+        (sessionp (not (member (cdr (assq :session params)) '("no" "none")))))
+    (if (and async (not sessionp))
+          (error (org-babel-eval-error-notify 1 "ERROR: must use 'async' with 'session'")))
     (and async
-	 (not org-babel-exp-reference-buffer)
-         (not (equal (cdr async) "no"))
-         (not (equal (cdr session) "none")))))
+         sessionp
+         (not org-babel-exp-reference-buffer))))
 
 (defun org-babel-comint-async-filter (string)
   "Captures Babel async output from comint buffer back to Org mode buffers.

It's really just a nicety.  The user can cancel the accidental blocking process with C-g.  However, the block is run in a different shell than expected and it's jarring to have Emacs freeze when you expect async.

Thoughts on including it or something similar?
------=_Part_325912_512302212.1679972032451
Content-Type: application/octet-stream; 
	name=error-on-async-session-mismatch.diff
Content-Transfer-Encoding: 7bit
X-ZM_AttachId: 138992648324520050
Content-Disposition: attachment; 
	filename=error-on-async-session-mismatch.diff

diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el
index 86c2bf7a7..384bfcda8 100644
--- a/lisp/ob-comint.el
+++ b/lisp/ob-comint.el
@@ -206,11 +206,12 @@ comint outputs due to buffering.")
 PARAMS are the header arguments as passed to
 `org-babel-execute:lang'."
   (let ((async (assq :async params))
-        (session (assq :session params)))
+        (sessionp (not (member (cdr (assq :session params)) '("no" "none")))))
+    (if (and async (not sessionp))
+          (error (org-babel-eval-error-notify 1 "ERROR: must use 'async' with 'session'")))
     (and async
-	 (not org-babel-exp-reference-buffer)
-         (not (equal (cdr async) "no"))
-         (not (equal (cdr session) "none")))))
+         sessionp
+         (not org-babel-exp-reference-buffer))))
 
 (defun org-babel-comint-async-filter (string)
   "Captures Babel async output from comint buffer back to Org mode buffers.

------=_Part_325912_512302212.1679972032451--