From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 uNp0G83w9WNUWQAAbAwnHQ (envelope-from ) for ; Wed, 22 Feb 2023 11:39:09 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id aNdUG83w9WNnRAEAauVa8A (envelope-from ) for ; Wed, 22 Feb 2023 11:39:09 +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 152EA99BC for ; Wed, 22 Feb 2023 11:39:08 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUmVn-0003w5-TL; Wed, 22 Feb 2023 05:38:12 -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 1pUmVm-0003vd-89 for emacs-orgmode@gnu.org; Wed, 22 Feb 2023 05:38:10 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUmVj-0000dG-3t for emacs-orgmode@gnu.org; Wed, 22 Feb 2023 05:38:09 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 3DC452404BD for ; Wed, 22 Feb 2023 11:38:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1677062284; bh=SxpkMIpoiZzPcGcHRdFnUJCuyYbGjevX5F6RNRNDcAE=; h=From:To:Cc:Subject:Date:From; b=CLZJooG4B10GijJ4bYoD43bjM59GTwcXAmWB/vy75Hd5cgUz/xo71z/efj0oaMlIo Q1Py+apQWpxy/gqiBApmWmfkSVkVkD5lYhRWbd6l2beFk6/D6B692Bcpc/Tzz4GwAG 5Vn/1A4zkcJm1N13xv2v6+lV3S+i10KUD9xxJOudSD54S9ZSyj3UxxBR1WgpVzBzX9 nHYycFtuZWVc6clWpfq3RNb6E1VUdRKU76QpAstmk5eVedoh8fy+s1vbTGa4pZ8P8c XF9dRaM/Pm97eWeTRXJmUgoAf9ps4Zpugk5fFTjsSXLlRqXK+K9xJhnvFCxAx2z4NG QxanB0wU2F6pg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PMCKh6GY6z6ts7; Wed, 22 Feb 2023 11:38:00 +0100 (CET) From: Ihor Radchenko To: Jack Kamm Cc: Matt , emacs-orgmode Subject: Re: [BUG] shell sessions started outside of Babel broken In-Reply-To: <87pma31tj7.fsf@gmail.com> References: <186283d230a.129f5feb61660123.3289004102603503414@excalamus.com> <87a61j3orj.fsf@gmail.com> <1864701b4b8.e37160d6373275.4308190093579612690@excalamus.com> <87357a2r27.fsf@gmail.com> <1864bbf632d.acf83486624816.5548943856411522610@excalamus.com> <87wn4j1mee.fsf@gmail.com> <875yc1wz37.fsf@localhost> <87ttzhy9vm.fsf@gmail.com> <87ttzgeg3w.fsf@localhost> <87pma31tj7.fsf@gmail.com> Date: Wed, 22 Feb 2023 10:38:43 +0000 Message-ID: <87pma2c7d8.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, 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-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1677062349; a=rsa-sha256; cv=none; b=tTUvsmsH14ZmleWdwpP8B4pxo4/2J6gpptT+4rWl0zt5cy2vyMjBrzJK0QgCcvQKdIKL/A UdhvOfNlBamZFiKqVDjQpFz1CcN8VLyipDkr6Z3Q98AfSZetDHJ+pJ+xa+42TItwzGPT3j ZwRf2jLYoZRxbqLh/8CGySP/erPLxprdW+53tvKnqYrNKmUPt1hDkUrEYdM+Q4XdVa8Q0C qJMmVW6pjhNljgDkSPLDKJrPSV1onmcXAJSaDSkC6sm/rglifDtoRcGftQi9mSdLcev9o3 IjfOeDAWofivnQsUN9NBdZwSnhNBY3OR6+lvxD2sRGLkJq7Wj7z/WlcDhfQ/eQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=CLZJooG4; dmarc=pass (policy=none) header.from=posteo.net; 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=1677062349; 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=5Z1pQMrHBjK0OLggL66tpKbx3SLlj2uqC5FJF+VOhGo=; b=sQtgtZOdPziJ+oLzdBoDkCslhMWYAVQrLFLK4VYlnkO9YRafNANBOvpi1Jogqru6bJy0pt EPZppN8PYCETJPIRJXFJyp3E/EHPKtM3WyR6jeHtCpJ+QZzcW6pLC1+OGRs08N1idLjhzK CDEs76o4LOyIcxaDDfS/Qp8CygxQax95ARguv5Z1AtJK5X2qR0tQGrRCNZGYI3I5F89KR1 G7FOdL6ufaWwMO2+sTy+Allqxw6qRysh6MITsHmSUEiEtckKtrwzlHMflxlYDCTq1MXLWA FOQdUCD3umOh7jBCO7cJaBxl3Zu36BAJq2w/7bnh1D4uIug5ihamKsn9Ns8CdQ== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=CLZJooG4; dmarc=pass (policy=none) header.from=posteo.net; 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-Migadu-Spam-Score: -6.15 X-Spam-Score: -6.15 X-Migadu-Queue-Id: 152EA99BC X-TUID: t0RvXyWSPdyr Jack Kamm writes: > Ihor Radchenko writes: > >> What is confusing is that `org-babel-execute-src-block' does not use >> generic `org-babel-initiate-session'. > > I usually find myself confused whenever I am trying to remember > where org-babel-LANG-initiate-session is run and what it's doing... AFAIU, org-babel-LANG-initiate-session is ran the first time the session is started. Its job is setting the comint to work with babel. org-babel-LANG-prep-session is ran before a code block is executed within a session. Its purpose is applying header args (like variable bindings) and performing other immediate preparations to actually execute the src block. > In ob-shell's case, when I read the lisp code it seems like > org-babel-prompt-command would get called every time > org-babel-execute:shell runs (via org-babel-sh-initiate-session). No. `org-babel-sh-initiate-session' has (or (org-babel-comint-buffer-livep session) ...) So, it does nothing when the session buffer is already present. > But that's not how the behavior seems when I use it, e.g. if using a > M-x shell session, the prompt isn't changed after executing a src > block. Because `org-babel-comint-buffer-livep' will return t for a buffer created by M-x shell. It may or may not be a bug. We can, for example, make `org-babel-comint-buffer-livep' return nil unless a special buffer-local indicator is set upon evaluating `org-babel-sh-initiate-session'. However, it may be tricky in general case because what we have to do when creating a new session buffer may or may not be the same with what we have to do when M-x shell buffer exists already. >> We may, however, allow an extra header arg to set the prompt regexp >> manually. Would it make sense? > > It does feel a little confusing, but I don't have any better ideas at > the moment. > > To clarify -- would the header arg be for setting > comint-prompt-regexp, org-babel-prompt-command, both, or something > else? I imagine that the header arg will be setting comint-prompt-regexp. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at