From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id MDcECFQC6GP22QAAbAwnHQ (envelope-from ) for ; Sat, 11 Feb 2023 22:02:12 +0100 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 4BMZB1QC6GNKzgAAG6o9tA (envelope-from ) for ; Sat, 11 Feb 2023 22:02:12 +0100 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 9DD9429445 for ; Sat, 11 Feb 2023 22:02:09 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQwzi-0003N4-1F; Sat, 11 Feb 2023 16:01:14 -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 1pQwzf-0003M8-Ut for emacs-orgmode@gnu.org; Sat, 11 Feb 2023 16:01:11 -0500 Received: from mail-108-mta195.mxroute.com ([136.175.108.195]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pQwzd-0004Gk-LT for emacs-orgmode@gnu.org; Sat, 11 Feb 2023 16:01:11 -0500 Received: from mail-111-mta2.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta195.mxroute.com (ZoneMTA) with ESMTPSA id 186424377d8000011e.002 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Sat, 11 Feb 2023 20:56:03 +0000 X-Zone-Loop: 148bd557886d66986cb8c86487833d4335e86c69ac98 X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tatersworld.org; s=x; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3pH6pHeUyY/ajZVqOUWOJEvvVQAqYHKWn70CYQpnxpg=; b=SjtW0PDfdlcmrp99ZQc7oY1hQg ZHcgU/Q6EeDmnEzlQmv1HDDu3jR0r6yOYSeqOvbVAdBJZPntRVIS/8lGdP7wkA7gdS9jQpYzPz7nz prsTuwUpR5qnFlitOX7u1U6cSTL37gWGVHc5HhG+O79p/wawkA2MYFV96/bcxVY0nfdz40Oo875pr vVuur4DoDYfZmkj+cYhg/hbXg/C0wDVhW8oRdEsb+2Plm6aRtC6BhevWcY7OkN1+AXjFnJr/PW3L4 n2ScMRrkP3WhG+6Du12rUFlQGw6ZTyVhKoJ963/cDVpXdNSId1zIusu0cAGBgJPV56b5wK6L0YtpZ qyxQdQxQ==; From: jackkamm@tatersworld.org To: Matt , emacs-orgmode Subject: Re: [PATCH] Async evaluation in ob-shell In-Reply-To: <186283d230a.129f5feb61660123.3289004102603503414@excalamus.com> References: <186283d230a.129f5feb61660123.3289004102603503414@excalamus.com> Date: Sat, 11 Feb 2023 12:56:00 -0800 Message-ID: <87a61j3orj.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Authenticated-Id: jackkamm@tatersworld.org Received-SPF: pass client-ip=136.175.108.195; envelope-from=jackkamm@tatersworld.org; helo=mail-108-mta195.mxroute.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, 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." 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676149331; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=3pH6pHeUyY/ajZVqOUWOJEvvVQAqYHKWn70CYQpnxpg=; b=EFk6vlTUSVeJbIsjQtOzc2DOiOSsFB3jGwZxYZzhVVOgOHTe2KtIt3qsg69ObQaWQIasBG roUXOsrIgbUmo0MESyBVxSiT3dXFyQyeCaQEbh33YNDpm+tm0TAFPECDZ3EwGN4jOvITzK wJaXQvrPfuhCRuLsg74ucUPMyA8cJ6/u67ctnwyHm77LwVSKUrqhd8YwwfQeCYwCR7YL/t E10hYnNDn1bOSEYAXgLK5Ro2Sx9ywLWH2tD0I4iHkj2izzY1+0Mm0+I4Kf4ElYWStlXYww csKsxAnqntp3nFuwHqPCWFjlmzvb7Z3gV3rYVLLw7q1VdZ028cb/xbvbdbwtyg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tatersworld.org header.s=x header.b=SjtW0PDf; 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-Seal: i=1; s=key1; d=yhetil.org; t=1676149331; a=rsa-sha256; cv=none; b=O0+j6E0k4JvMjHunUjaNHiO6K9grLFMPCbndAmNHhdtIuVm8y2HYbfMGi+ZjpnkKbzI5Wj ynXfcEkCIIgryZlVGD5gNtN8Jdc5dmeMpX2o+B4uVh2o4pfHJXw17fYW+bL4J0rNDX+7sI bswYXlGPvaQ8fAm0f8e0YAmVDLwykdLxLZNQbNbvfXShYPWZjUg1tJc0sLGWek0Zl6iFr/ PYY5FgaI6vjbJfFZ88ttlBYpajZI03lnOd/hW2fjrM/yu4uNhOiHP8/NqVua0Nq+YnljXx SUyyECmNLiE+bfXuQLcpF9nSsvK4L7zIs4u9f81q9QeZ6LKQXNhxuoMMH+cHkg== X-Migadu-Queue-Id: 9DD9429445 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tatersworld.org header.s=x header.b=SjtW0PDf; 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 X-Migadu-Spam-Score: -1.91 X-Spam-Score: -1.91 X-TUID: xf+QFY9rgdry Matt writes: > It's not clear to me if that's something that a better regexp would handle or if it should be cleaned up in the callback function. I'm still figuring out how it's done in ob-python and ob-R. ob-python and ob-R call out to python.el or ESS to evaluate code. IIRC, they will write code to tempfile and then source the tempfile within python or R session. So then we don't need to worry about cleaning up prompts between the lines. org-babel-comint-async-filter is capable of taking a similar approach, and reading/writing to tempfile. I believe this approach would be generally more robust, but the major weakness is that it would break if you SSH'd to a remote host in the middle of the session. There was an interesting patch to ob-shell that was never applied, that took the approach of wrapping the code block in a bash function before executing; I think it might be a promising approach: https://lists.gnu.org/archive/html/emacs-orgmode/2020-02/msg00923.html By the way, I took a look at ob-shell for the first time in awhile, and noticed that ob-shell now forces the prompt to be like: org_babel_sh_prompt> Which I think makes cleaning up the prompt markers a lot more robust. But it is a bit ugly, and also seems to break working with shell sessions started outside of Babel with M-x shell.