all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Ivar Fredholm <freddyholms@protonmail.com>
Cc: Tim Cross <theophilusx@gmail.com>,  emacs-orgmode@gnu.org
Subject: Re: Using exec functions to simplify session code
Date: Sun, 26 Jun 2022 12:33:39 +0800	[thread overview]
Message-ID: <875yko3uxo.fsf@localhost> (raw)
In-Reply-To: <4GgreROUkMant3E8LK7kKgeciZbHZDaEywwaKsZk34klCmvBr9paFe9ay4YziC80ubNd7mqwbbETwbjv6Q9EIs_3M1mM_Mv3H9cHOOyVr1I=@protonmail.com>

Ivar Fredholm <freddyholms@protonmail.com> writes:

> At this point, Babel calls org-babel-execute:python, which decides, based on the 'session' header, whether or not to call python3 tmp_code.py or to feed each line in tmp_code.py into the session interpreter. What I am wondering is if we could replace the code for the latter option (in ob-comint.el) by just sending the interpreter the command 'exec(open("tmp_code.py").read())'.

ob-comint.el knows nothing about the interpreter. So, what you are
describing should be implemented by the corresponding ob-*.el backends.
They know all the details about the interpreter being used.

Also, some interpreters behave differently if they run commands
line-by-line vs. inside script file. In particular, the script commands
may be echoed before their output in some cases (e.g. bash scripts and
.bat files, AFAIR).

Best,
Ihor


      reply	other threads:[~2022-06-26  4:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 23:57 Using exec functions to simplify session code Ivar Fredholm
2022-06-24  0:53 ` Tim Cross
2022-06-24  1:31   ` Ivar Fredholm
2022-06-26  4:33     ` 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

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

  git send-email \
    --in-reply-to=875yko3uxo.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=freddyholms@protonmail.com \
    --cc=theophilusx@gmail.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.