From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:700:3204::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id AB85B5s3nmUbrQAAkFu2QA (envelope-from ) for ; Wed, 10 Jan 2024 07:22:19 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id YChlOpo3nmWbCQAAe85BDQ (envelope-from ) for ; Wed, 10 Jan 2024 07:22:19 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="I9r/VMOT"; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1704867738; 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=ZDuKm2zxWTyjKL+JGH9zxhHdYAeEX+y5L60ItZXiLCA=; b=hioL1AMxybhZL++b4uhDsdLIHlJmaOikSSQYvV5+WxRBSIg8jwFs9J7zeo5I2lACldYSXj +25S0tY/JnzEBuEFdazz50j+7oJ4QHXCohRGCqzwA0j+5PnrsIKoVNc2c7U4SqlA/FMw9Y 1dbp4NT/HFzV2uaNd+vrqQz05RiPq37k04waCq71emqH0eoxI6G17p6O1K1RhZZgSgx6Qt 7uGJM7Ra0mFXus4HrdU5jvi5asUfLm4i+Tlh9xxetW39PIvn5TvKVhgBr+sOzGJdRAlusO RsnvfxeN9TxEVqY9rrmAfDYsY0sYbaUWjhGt8GxgFYwQ+Pi4DArSEtpVYYN9xg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1704867738; a=rsa-sha256; cv=none; b=Kht2jvuiOEWR8LtxR8wzQQASX6MgZWrqqypBQ/W8QoAoEkJpAsLa7PnRMskDe0Xqnyf5HH PZwSSUvCe50yeYe9kPngu3bZ07F9lpaLXppkkdZyFIhq7TVRp1IcYKy1WqEqUGkv68wDNK QvgbEMCuSVsNCkmrJPl1vcQNDw1VY1XG+L0DKlEkmCbO/fiWLDCodm7xtGT1sI5miqpHbz NSJHBoVkhmj/+0f8snO7ReAWYJLXCtb8TzZk5JNh+VY+6fLwCIEpGsbs69dpr/Z5wRRWVB S1UwqmopP1N8ldnWJiAGLAM9uaBNLgu3zWSTKmyGZlM8xR2Hu5ogETETOadFIQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="I9r/VMOT"; 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"; dmarc=pass (policy=none) header.from=gmail.com 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 72D035B826 for ; Wed, 10 Jan 2024 07:22:18 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNRxl-0008Pe-MY; Wed, 10 Jan 2024 01:21:17 -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 1rNRxk-0008PU-4h for emacs-orgmode@gnu.org; Wed, 10 Jan 2024 01:21:16 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNRxh-0006aA-VO for emacs-orgmode@gnu.org; Wed, 10 Jan 2024 01:21:15 -0500 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1d3aa0321b5so33808995ad.2 for ; Tue, 09 Jan 2024 22:21:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704867672; x=1705472472; darn=gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ZDuKm2zxWTyjKL+JGH9zxhHdYAeEX+y5L60ItZXiLCA=; b=I9r/VMOTDM2lUqQfwCVvDKjhujpUoDOXfxpKyKeYOlfcYoZY0H1xZRE1+TiNFq8vM+ AmIEgTaWfGtx/B89rxKe+loCVRB32C8PkeUWim965FPpBOlTtR3H89wW0auvlz3oXmhp U6XQEU7GhMuKiZdHdHusFtnnnJC27NFIuEQZkk2N001Ug7RiwU+j2sznpsPLaX7usrUM rTLGinIU14fzsaOJKavOB1fDJO73YDIdDYNfMv4X4Ap2PUKMVJGmrbixTzj1ocY1fFI9 BFqTG4NrSh3w80R+PFN+mV0/409L++NJX2XZlj5KxAhQgcqXRrS2hQwEZp29dUVF+q4b zmAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704867672; x=1705472472; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZDuKm2zxWTyjKL+JGH9zxhHdYAeEX+y5L60ItZXiLCA=; b=iWkZnUKIbmDjTiQje7K5X+HBJSVBLTT6BVBBoa/b4C0qUC2HP4H86ZpVl4syieHIlR zzDD2heeX+13cT64y7LuOw6hZUhfLVIFr61uptkv2CFrx71DpbBviC0MP7wnUxhP6IRq iAoRCQ1uWJjNn2/ZPG1zNYlxgKd8qRelEuj6oMXaGVcWu3TKF7k6YrwdPtDfg+BFwl3v X8Lw2BPAdlZ/kZHiANI4SUiAJmiNOJtICTcB7lNo/Oeg3okOMfx/6WMCGprv9eEgVy6u Gw6sVPfjVIgpOnyoVaPOX+y6tXXRejsYl7zNAVo/tqUMnbY9CvztHMhJ05bciT8XJz3y gcog== X-Gm-Message-State: AOJu0YxjIff6ukuRXpexPIWdgL0JVRfqCPVqautMzVNMq9gCLZLHE+Gg C+rMPSBMBwumnMUjiTElnPW+y/yQBWA= X-Google-Smtp-Source: AGHT+IFYoMhy0pGnIwAI13gSLBIL1xuY2wv32sp57n1as5HfayA4gVASfAScgLwAEJLeUOiPuVnNOQ== X-Received: by 2002:a17:902:cece:b0:1d3:d0ff:f49c with SMTP id d14-20020a170902cece00b001d3d0fff49cmr629792plg.21.1704867671501; Tue, 09 Jan 2024 22:21:11 -0800 (PST) Received: from localhost (157-131-78-143.fiber.dynamic.sonic.net. [157.131.78.143]) by smtp.gmail.com with ESMTPSA id bd4-20020a170902830400b001d4b6d64041sm2791852plb.240.2024.01.09.22.21.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 22:21:10 -0800 (PST) From: Jack Kamm To: Ihor Radchenko Cc: Liu Hui , emacs-orgmode@gnu.org Subject: Re: [PATCH] Set Python shell in Org edit buffer In-Reply-To: <87zfxewewe.fsf@localhost> References: <87ttovlb1u.fsf@localhost> <878r6647vv.fsf@localhost> <87bkb2rqer.fsf@localhost> <87edfwsuvx.fsf@localhost> <87sf4bsm1w.fsf@localhost> <87mstw18r4.fsf@gmail.com> <87bkaak0ol.fsf@localhost> <87ttnyz0jv.fsf@gmail.com> <87wmsn6ghw.fsf@localhost> <87o7dxu15h.fsf@gmail.com> <87msthwbfz.fsf@localhost> <87le91t13e.fsf@gmail.com> <87zfxgxb8m.fsf@localhost> <87r0ir2ln8.fsf@gmail.com> <87zfxewewe.fsf@localhost> Date: Tue, 09 Jan 2024 22:21:09 -0800 Message-ID: <87le8x3e0a.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=jackkamm@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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." 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.62 X-Spam-Score: -9.62 X-Migadu-Queue-Id: 72D035B826 X-Migadu-Scanner: mx11.migadu.com X-TUID: ZpUlhxOgB7Te Ihor Radchenko 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.