From: Jack Kamm <jackkamm@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Liu Hui <liuhui1610@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] Set Python shell in Org edit buffer
Date: Tue, 09 Jan 2024 22:21:09 -0800 [thread overview]
Message-ID: <87le8x3e0a.fsf@gmail.com> (raw)
In-Reply-To: <87zfxewewe.fsf@localhost>
Ihor Radchenko <yantar92@posteo.net> writes:
> See the attached tentative patch.
Thanks!
> ---
> etc/ORG-NEWS | 11 +++++++++++
> lisp/ob-R.el | 20 ++++++--------------
> lisp/ob-julia.el | 16 +++++++++-------
> 3 files changed, 26 insertions(+), 21 deletions(-)
Not sure if you are doing this in a separate commit, but you also need
to make the change to org-src.el to remove
(org-babel-comint-buffer-livep session)
in `org-src-associate-babel-session'. Else,
`org-babel-R-associate-session' won't run if there's no live session,
and hence ESS won't create new session with the right name.
> * Version 9.7 (not released yet)
> ** Important announcements and breaking changes
> +*** ~org-edit-special~ no longer force-starts session in R and Julia source blocks
> +
> +Previously, when R/Julia source block had =:session= header argument
> +set to a session name with "earmuffs" (like =*session-name*=),
> +~org-edit-special~ always started a session, if it does not exist.
> +
> +Now, ~org-edit-special~ arranges that a new session with correct name
> +is initiated only when user explicitly executes R/Julia-mode commands
> +that trigger session interactions. The same session will remain
> +available in the context of Org babel.
I tested the patch (plus the additional change to org-src.el), with an
Org file with following 2 blocks:
#+begin_src R :session foo :results output
print('foo')
#+end_src
#+begin_src R :session *bar* :results output
print('bar')
#+end_src
On block "foo", I did C-', and then ess-eval-line. It creates a session
named "foo", as expected.
On block "*bar*", I did the same. It does not create session named
"*bar*", instead evaluating in session "foo". It seems ESS will always
assume you want to evaluate in existing session if one exists, rather
than start a new associated session, and it seems there is no way to
tell it to behave otherwise.
However, calling "M-x R" while editing block "*bar*" does create session
"*bar*" with correct name.
After sessions "foo" and "*bar*" have both been created, doing C-' and
then ess-eval-line will evaluate in the correct session.
It's annoying there's no way to tell ESS to start new session instead of
evaluating in existing one. Here are a few alternatives we could
consider to deal with this:
1. Change the worg/ORG-NEWS, to suggest users make sure the session
exists (either by evaluating a source block or call "M-x R" in edit
block) before running ess-eval-line.
2. Add ob-R and ob-julia customization options (as previously suggested)
to explicitly control the startup behavior (either to auto-start, or not).
3. Submit PR to ESS to add a variable we could let-bind, to force it to
start an associated session rather than evaluate in an existing
non-associated sessions.
Currently I lean towards a combination of #1 and #3, but am not sure,
and happy to go with whatever you think is best.
next prev parent reply other threads:[~2024-01-10 6:22 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-05 10:18 [PATCH] Set Python shell in Org edit buffer Liu Hui
2023-12-05 11:51 ` Ihor Radchenko
2023-12-06 4:41 ` Liu Hui
2023-12-06 13:23 ` Ihor Radchenko
2023-12-07 4:45 ` Liu Hui
2023-12-07 10:36 ` Ihor Radchenko
2023-12-07 14:17 ` Liu Hui
2023-12-07 15:19 ` Ihor Radchenko
2023-12-08 10:19 ` Liu Hui
2023-12-08 13:09 ` Ihor Radchenko
2023-12-09 2:33 ` Liu Hui
2023-12-09 10:32 ` Ihor Radchenko
2023-12-09 13:36 ` Liu Hui
2023-12-27 6:04 ` Jack Kamm
2023-12-28 11:48 ` Ihor Radchenko
2023-12-31 18:31 ` Jack Kamm
2024-01-05 13:45 ` Ihor Radchenko
2024-01-05 23:29 ` Christopher M. Miles
2024-01-12 11:58 ` [ob-clojure] Clojure sessions in Org Src buffers (was: [PATCH] Set Python shell in Org edit buffer) Ihor Radchenko
2024-01-07 6:07 ` [PATCH] Set Python shell in Org edit buffer Jack Kamm
2024-01-07 12:54 ` Ihor Radchenko
2024-01-07 19:06 ` Jack Kamm
2024-01-07 23:14 ` William Denton
2024-01-08 12:26 ` Ihor Radchenko
2024-01-09 4:09 ` Jack Kamm
2024-01-09 4:25 ` Jack Kamm
2024-01-09 18:16 ` Ihor Radchenko
2024-01-10 6:21 ` Jack Kamm [this message]
2024-01-10 12:18 ` [FR] Add buffer-local setting to request specific ESS process/session name (was: [PATCH] Set Python shell in Org edit buffer) Ihor Radchenko
2024-01-10 19:14 ` Sparapani, Rodney
2024-01-10 19:15 ` Sparapani, Rodney
2024-01-10 19:31 ` Ihor Radchenko
2024-01-10 19:39 ` Sparapani, Rodney
2024-01-10 20:15 ` Ihor Radchenko
2024-01-10 21:44 ` [External] " Richard M. Heiberger
2024-01-10 21:53 ` Ihor Radchenko
2024-01-21 11:48 ` [PATCH] " Ihor Radchenko
2024-01-21 18:21 ` Sparapani, Rodney
2024-01-22 12:13 ` Ihor Radchenko
2024-01-22 13:46 ` Martin Maechler
2024-01-25 13:09 ` Ihor Radchenko
2024-01-25 15:23 ` Sparapani, Rodney
2024-01-25 15:33 ` Ihor Radchenko
2024-01-25 15:42 ` Sparapani, Rodney
2024-01-25 22:47 ` Ihor Radchenko
2024-01-10 12:19 ` [PATCH] Set Python shell in Org edit buffer Ihor Radchenko
2024-01-14 17:23 ` Jack Kamm
2024-01-16 13:49 ` Ihor Radchenko
2024-01-16 16:05 ` Jack Kamm
2024-01-28 19:12 ` Ihor Radchenko
2024-01-29 4:23 ` Jack Kamm
2023-12-27 6:07 ` Jack Kamm
2023-12-28 11:51 ` Ihor Radchenko
2023-12-29 16:04 ` Jack Kamm
2023-12-31 13:05 ` Ihor Radchenko
2023-12-31 18:14 ` Jack Kamm
2024-01-05 14:00 ` Ihor Radchenko
2023-12-29 22:20 ` Jack Kamm
2023-12-30 7:08 ` Liu Hui
2024-01-28 20:35 ` Ihor Radchenko
2024-01-29 4:21 ` Jack Kamm
2024-01-29 13:31 ` Ihor Radchenko
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=87le8x3e0a.fsf@gmail.com \
--to=jackkamm@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=liuhui1610@gmail.com \
--cc=yantar92@posteo.net \
/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).