emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: "Cook, Malcolm" <MEC@stowers.org>
Cc: "matt@excalamus.com" <matt@excalamus.com>,
	"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>,
	"jackkamm@tatersworld.org" <jackkamm@tatersworld.org>
Subject: Re: [BUG] conda doesn't work in ob-shell sessions AND org-babel-execute-src-block filters characters from :session *shell* output
Date: Sun, 15 Dec 2024 14:21:56 +0000	[thread overview]
Message-ID: <871py99gcb.fsf@localhost> (raw)
In-Reply-To: <DS7PR20MB4671E61718CEC1FD86DAC722BE4D2@DS7PR20MB4671.namprd20.prod.outlook.com>

"Cook, Malcolm" <MEC@stowers.org> writes:

> #+begin_src shell :session *shell* :results output
> conda create --yes --name myenv python=3.9
> #+end_src
> ...
> #+begin_src shell :session *shell* :results output
>   conda activate myenv
> #+end_src
>
> #+RESULTS:
>
> #+begin_src shell :session *shell* :results output
> which python
> #+end_src
>
> #+RESULTS:
> : /n/projects/mec/SRSCHPC2/local/inst/Mambaforge/24.3.0-0/envs/myenv/bin/python
>
> #+caption: alas, the output of test_filter is changed.  Some lines are gone missing and some are changed.
> #+call: test_filter()
> ...

This is likely because conda changes the prompt, which Org mode does not
expect.

I am afraid that there is no general magic solution to detecting
prompts. We either try heuristics and hit false-positives (that's what
we did in the past) or set very specific prompt and try to search it
(now). In the latter case, any changes to the prompt will break things.

What can be done is force-setting the prompt every single time babel
sends output to the comint buffer, but it feels wrong.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


      reply	other threads:[~2024-12-15 14:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23 15:31 [BUG] conda doesn't work in ob-shell sessions AND org-babel-execute-src-block filters characters from :session *shell* output Cook, Malcolm
2024-12-15 14:21 ` Ihor Radchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871py99gcb.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=MEC@stowers.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=jackkamm@tatersworld.org \
    --cc=matt@excalamus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).