From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id iGVQIa6PUmSLUgAASxT56A (envelope-from ) for ; Wed, 03 May 2023 18:45:34 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id AD4AIa6PUmS6lgAAauVa8A (envelope-from ) for ; Wed, 03 May 2023 18:45:34 +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 34C923AEBC for ; Wed, 3 May 2023 18:45:34 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puFb0-00028m-NR; Wed, 03 May 2023 12:44:50 -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 ) id 1puFat-00028P-9G for emacs-orgmode@gnu.org; Wed, 03 May 2023 12:44:43 -0400 Received: from [39.171.215.100] (helo=Mac-mini.local) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puFar-00069p-83 for emacs-orgmode@gnu.org; Wed, 03 May 2023 12:44:42 -0400 Received: by Mac-mini.local (Postfix, from userid 501) id 306E98AF5CBF; Thu, 4 May 2023 00:44:32 +0800 (CST) References: <87354hs9pz.fsf@localhost> <87mt2oqyup.fsf@localhost> <187de29d882.c92c2b661216812.7786590004610447376@excalamus.com> <878re5g0ir.fsf@localhost> <87lei5aajy.fsf@localhost> User-agent: mu4e 1.10.3; emacs 30.0.50 From: "Christopher M. Miles" To: Ihor Radchenko Cc: numbchild@gmail.com, Matt , emacs-orgmode@gnu.org Subject: Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively Date: Thu, 04 May 2023 00:31:50 +0800 In-reply-to: <87lei5aajy.fsf@localhost> Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Host-Lookup-Failed: Reverse DNS lookup failed for 39.171.215.100 (deferred) Received-SPF: softfail client-ip=39.171.215.100; envelope-from=numbchild@gmail.com; helo=Mac-mini.local X-Spam_score_int: 58 X-Spam_score: 5.8 X-Spam_bar: +++++ X-Spam_report: (5.8 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FROM=0.001, MSGID_MULTIPLE_AT=1, NML_ADSP_CUSTOM_MED=0.9, RCVD_IN_PBL=3.335, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, SPOOFED_FREEMAIL_NO_RDNS=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: reject 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: , Reply-To: numbchild@gmail.com 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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683132334; a=rsa-sha256; cv=none; b=javTQzA9FfPl85/A2+T93G+ZbK/LApDjN12ZGh3zQxW+p/ChT/4IOySwxtjBx72kWl4err UPsW1yn9eXiWPkXYvCnh4NO8OYhizRvXJHt4t2ocpXMk1oUO1QavrN7vcP9u8mIbAGQTe5 HqW+ex1m5PmF3Bo+2vAkeQAsK7CENjB01w+REGk5sePRbG+nzbS9Ac+z+aaSCrlh8OqUIQ Ac1uHJCG8SOvgAKvnMgNuqGGVgeuPa8ArkZf5RyvyT3TWrqRw3AW+6cxRtsgv7rxHapg1v qbzI5NNRNE8YTKqAFydrh9E6G5lSzOg48OkZmvBbCUVUm8g9W6crHJc8U8zflA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683132334; h=from:from:sender:sender:reply-to: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; bh=fFmb2E9pPuPvWW2vz+FzF9Sci0HQzeH6X4SRdOxyUpk=; b=hZ71+s8b6DGyuhng9zu+BBtJ2AOWNGpfzCGStTgFO5JGgc177jYNkzHQZNIE/x0DOD9s/U sR52+ffzi3n4FnrCbxUyYyGSIVinF0ExSkwlYDA/O9zmGUfcTv5xFutdxs6ia7eFZSaCej WPz4DMkOWJvXHLOfxg7YE1zx5kzzgY55EHT+D/kOWZUKfrG1TvNt1Cr4DW2XzSBbTWxN9k qYwdMMD87E0kUoC9kyng+psRqPro025dVTtIFILooebcvNKlsVevloxpw4KXWBhdfTvX/6 1V5V8+sA7n8CIkF8qjPyHLyFz0iU/0B4f2tZ7EqFUI1JgqGjfbgGQp41P/HtKg== X-Migadu-Spam-Score: -4.80 X-Spam-Score: -4.80 X-Migadu-Queue-Id: 34C923AEBC X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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" X-TUID: U8YcTJZ/Qs9N --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ihor Radchenko writes: > "Christopher M. Miles" writes: > >> So currently ob-shell.el is async sending command into session buffer >> without waiting for command to be finished. >> >> I checked out the ob-shell.el source code. I suppose this is the core >> part of the problem. From intuitive view, session async evaluation >> indeed should not wait for command to be finished. But still feel a >> little weird. > > The core of the problem is in how Emacs comint is sending multiline > input. My earlier example with M-x shell also demonstrates what is > penning. comint.el basically simulates user input verbatim, as if you > typed the whole thing symbol by symbol, including newlines. > > And it makes total sense as long as you are actually typing things > interactively in the comint buffer. > > ob-shell :session in this case gets a bit weird. On one hand, it > faithfully simulates interactive session. On the other hand, it does not > feel fully interactive from user perspective, as you send a bunch of > commands together within a single source block. > > One way to avoid the situations like with mpv could be packing the whole > code block into script and then sending that script to comint session > buffer. But then people who would like to actually switch to that buffer > and work with it manually will get confused about what is going on > there. (see `org-babel-switch-to-session' and > `org-babel-switch-to-session-with-code'). >> If this :stdin interesting idea works, maybe other similar ideas will to= o.=F0=9F=99=8B >> >> For examples: >> >> - Wrap command "mpv" with a shell function which disable accepting inter= active input. > > Is there such a function? For all possible POSIX shells? > >> - Setting shell or environment variable in :prolog for source block to p= reventing interactive input. > > Again, do you know how to do this? I tested with bash and wrap mpv into a function. The :prolog way is not working too. Seems those workaround tries can't get around the essential problem. I'm too naive.... =2D-=20 [ stardiviner ] I try to make every word tell the meaning that I want to express without mi= sunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmRSj20ACgkQG13xyVro msOAWwf+KoHGYFBlMo938crifqq/3fIgU2xM9MwAzIWGYd68UDd+ZCI36SVmXDt6 amt6ZDporjj6C9O71+QaA8LYvlmw9M06XX5dVVXdEJ2W0hCi/X+iciz9rXUwQend MmN9+ok0oTm1Dat2PNFy8kqeN/GAqrcqLZ6l7u1Me34xdUhXt9kDWdOeSLxW24eI gc+qSq0+2i0tklm66ZKFC/7NEjZiIyy5pEy9nhqwVkYPIjV+p+kl0mBzwMAMzL1U nx2donh2AFSvBxMDmS+bFJzOXjP7c//prep9wnE+KCLnu/jReMH/gq9f0K2N3Y0K z6VuvK7X5ueyOPJgjBvEPTWwhVjNAA== =T8SM -----END PGP SIGNATURE----- --=-=-=--