From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp2.migadu.com ([2001:41d0:403:4876::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms8.migadu.com with LMTPS
	id +PBUK9sKsGWdaAAAe85BDQ:P1
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 23 Jan 2024 19:52:11 +0100
Received: from aspmx1.migadu.com ([2001:41d0:403:4876::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp2.migadu.com with LMTPS
	id +PBUK9sKsGWdaAAAe85BDQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 23 Jan 2024 19:52:11 +0100
X-Envelope-To: larch@yhetil.org
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20230601 header.b=PCDqbShM;
	dmarc=pass (policy=none) header.from=gmail.com;
	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-Seal: i=1; s=key1; d=yhetil.org; t=1706035931; a=rsa-sha256; cv=none;
	b=sPI5VnXsC7gs9DWH/jObDrc9KHYJOBQj2g7W2+MlqAKwGPzd5gSipoCHa1LTwtqtxjcpRu
	TwIg95j7AbhENxjVfyRd/nZoxmk7YZUN2Vw5+3V82vxTKV0sohXs3ujR/7FW2+RNZm07F0
	tA1fObCJy8kbBEmrf4jzgSKVEsNjeUvPlvDymXB3MTsCD2HoKtmopLxujg6MNnsJohouUC
	uIkuRBhNFTseGmbAmdNeVVeqN8TZcfVMjcvYsfZwRj++AT01CiF1Raa+8zttjUkOHSbS1O
	VZHgS6h6cc52soQFnv4OgPBYf5U1yZ1qkd6+8x7i76gT0N3KWCZPdf74nuP8eg==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20230601 header.b=PCDqbShM;
	dmarc=pass (policy=none) header.from=gmail.com;
	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=1706035931;
	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:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:list-help:
	 list-unsubscribe:list-subscribe:list-post:dkim-signature;
	bh=NktpXMswSoNi52oc3yWTrAAII44Jlbb1UnTVVPCpsvc=;
	b=edTsDwFC6Xn0d8eENruatLAPruAd6SHagQQmI3f4q1/SCyy6Fco2BQj4sVshr/IbUZy5/F
	AlnZTfxRtz/M7QilTb1bk2OMpnosr8EYv5UEwv7Y2p/E/8e0sKeU37qyRLmzf5Uo9SgsHN
	rFW4p4Uf4R0XtNRjsm61vJM/G7Q9dsFdeDpNYHfk53jMleg8ABspNfq3nYBSvSrH4Wa+cz
	9mQheCCFpFDdsx7HoSpw9KSvGCTlM4Wj/oTxIH5cQfp2ZFBdm9jkl+JKx0jSJL0z1dXFIa
	5ZDDr47euc/ohB8CTSx7pKgS4JZ946zx4DGHyi4wz9PkFEVU7kqNytyuJM37Vw==
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 41D766E5BB
	for <larch@yhetil.org>; Tue, 23 Jan 2024 19:52:11 +0100 (CET)
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 1rSLrm-00024T-PR; Tue, 23 Jan 2024 13:51:23 -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 <suhailsingh247@gmail.com>)
 id 1rSLrb-0001s7-VU
 for emacs-orgmode@gnu.org; Tue, 23 Jan 2024 13:51:12 -0500
Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <suhailsingh247@gmail.com>)
 id 1rSLrZ-0004DI-Lt
 for emacs-orgmode@gnu.org; Tue, 23 Jan 2024 13:51:11 -0500
Received: by mail-qk1-x744.google.com with SMTP id
 af79cd13be357-783a83eea1fso17076785a.0
 for <emacs-orgmode@gnu.org>; Tue, 23 Jan 2024 10:51:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1706035867; x=1706640667; darn=gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:date:references
 :in-reply-to:subject:cc:to:from:message-id:from:to:cc:subject:date
 :message-id:reply-to;
 bh=NktpXMswSoNi52oc3yWTrAAII44Jlbb1UnTVVPCpsvc=;
 b=PCDqbShMtKJriLki50tX8KYeZSfoFbEh8v7MZrONXipnDLH1jm/vrlVjLXE6F5syOQ
 mpTXP6lEQh+k9TOPI0Y2OPVEq6w0ilX/5XhyMGDyB5lN48yLILD5CfzhzBB+iOg8QvJP
 GuuxN1Ub7qC5BBoQ345YxTCTxKablq/ofVNwkSPhlqvAxl989pe1eqNXvYDgH4vxp2at
 MS/yk90GuqnTSdx6rSl6ok7ua5wAByXBIo1lBGbMDUnjidsaUd3xlvtmPQt6+j8aX7Q8
 La66mQTpws3NjbCSGF5eiwx9RxP3+KkzxMQQnS/dKQY/vZp44b6DnFjLpSQIY02hrdca
 IcNg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1706035867; x=1706640667;
 h=content-transfer-encoding:mime-version:user-agent:date:references
 :in-reply-to:subject:cc:to:from:message-id:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=NktpXMswSoNi52oc3yWTrAAII44Jlbb1UnTVVPCpsvc=;
 b=OgWuJ8EKkRzzGXB+ZscXN9JJ31K6Cdf29sOyD99TnQMyABY4zyIwowzg9aSOr9jMB2
 /ragfSpdcDxAMHu+Bu5JcUE2HT9d4sk3oRPrGZEgH2pn7OGxEz6mcJDSk1c51+y+i4gq
 MrfGrZPynThYm/vMCNfamLArB78L/92PaAH42QGuPq9aS+6XtOvpew4d/iCCGzDP18gr
 V3ffVDxJFvyQI218QBp1svHLqKYqrk1DytpIBkiAoNyGqY5PLlBzAtNhjpq5V+UDkY+4
 kb5WWCAjYiSyNkzp/EPyfCH9xZSdGWDmtXdjkMSu+6miXjCEhiNWHoVg8/XWyVNjUcVc
 hTuA==
X-Gm-Message-State: AOJu0YwlGA4fAxcPzIZvjgJIiMozN8xh47A/iyyVeRAn6Fgx4eLXgmBa
 k9iaLHNdHDZYm1ArigYQe9j3jLNaruG2R02przims+sN6ctGaOYBPR+TdYB3g+U=
X-Google-Smtp-Source: AGHT+IFHwynMymbVhij2XWenZwLNiEYpFdIa1HHQVVqVr7+DnlMD+GbmDTBox/ndvAfrekj3a3MW0A==
X-Received: by 2002:a05:620a:1a26:b0:783:88e1:5221 with SMTP id
 bk38-20020a05620a1a2600b0078388e15221mr12424548qkb.6.1706035866912; 
 Tue, 23 Jan 2024 10:51:06 -0800 (PST)
Received: from gnus (static-198-44-140-145.cust.tzulo.com. [198.44.140.145])
 by smtp.gmail.com with ESMTPSA id
 z2-20020ae9c102000000b007834865dcd5sm3347685qki.126.2024.01.23.10.51.06
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 23 Jan 2024 10:51:06 -0800 (PST)
Message-ID: <65b00a9a.e90a0220.9f5d0.e0a2@mx.google.com>
X-Google-Original-Message-ID: <87wmrzvq7a.fsf@>
From: Suhail Singh <suhailsingh247@gmail.com>
To: Jack Kamm <jackkamm@tatersworld.org>
Cc: Ihor Radchenko <yantar92@posteo.net>,  Matt <matt@excalamus.com>,
 emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [BUG] conda doesn't work in ob-shell sessions
In-Reply-To: <87sf2q9ubd.fsf@gmail.com> (Jack Kamm's message of "Sun, 21 Jan
 2024 14:48:38 -0800")
References: <186283d230a.129f5feb61660123.3289004102603503414@excalamus.com>
 <87a61j3orj.fsf@gmail.com>
 <1864701b4b8.e37160d6373275.4308190093579612690@excalamus.com>
 <87357a2r27.fsf@gmail.com>
 <1864c676b9f.e1bae673679825.2955884247216895930@excalamus.com>
 <87ttzn1mai.fsf@gmail.com> <87h6jaj1pk.fsf@localhost>
 <87sf2q9ubd.fsf@gmail.com>
Date: Tue, 23 Jan 2024 13:51:05 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2607:f8b0:4864:20::744;
 envelope-from=suhailsingh247@gmail.com; helo=mail-qk1-x744.google.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 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>
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-Flow: FLOW_IN
X-Migadu-Country: US
X-Migadu-Scanner: mx10.migadu.com
X-Spam-Score: -8.58
X-Migadu-Queue-Id: 41D766E5BB
X-Migadu-Spam-Score: -8.58
X-TUID: /DDmvIFWcMiU

Jack Kamm <jackkamm@tatersworld.org> writes:

> #+begin_src shell :session *shell* :results output
>   conda activate some-conda-env
>   echo test
> #+end_src
>
> Then, on main branch, trying to execute the block hangs. It is because
> conda changes the prompt in a way that breaks the new ob-shell
> implementation.

This isn't a fix, but a workaround I've used for a while is to define a
function set_PS1 which I invoke after "conda activate" within org-babel
blocks.  set_PS1 (among other things that aren't relevant) compares PS1
against "(${CONDA_DEFAULT_ENV:-base}) org_babel_sh_prompt> ", and in
those cases sets PS1 to "org_babel_sh_prompt> ".  set_PS1 thus defined,
ensures that the follow block doesn't hang on first invocation.

#+begin_src bash :session conda-test :results replace
  conda activate test && set_PS1
  echo "${CONDA_DEFAULT_ENV}"
#+end_src

#+RESULTS:
: test

> ... on the first evaluation ("org-babel-execute:shell: Symbol=E2=80=99s v=
alue
> as variable is void: org-babel-prompt-command")

On org-version as recent as 9.6.17, when performing some actions such as
invoking org-metadown on a block with :session defined, I encounter the
same unless I have the below in my init.el:

#+begin_src elisp
  (defvar org-babel-prompt-command nil)
#+end_src

--=20
Suhail