From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.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 WLQdKwC6tmWFVwEAqHPOHw:P1 (envelope-from ) for ; Sun, 28 Jan 2024 21:33:04 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id WLQdKwC6tmWFVwEAqHPOHw (envelope-from ) for ; Sun, 28 Jan 2024 21:33:04 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Q0H5Tkhv; dmarc=pass (policy=none) header.from=posteo.net; 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=1706473984; a=rsa-sha256; cv=none; b=JPVrAsfoMtL5iv4oYAiXQ1/wOdCes1Tyq2pSTOIzEFJ8z2OE2zIq2TGFwAicOu8MXhUAQx LO5e6hpmpum7UEb9OFLLfmFt6zJeKD8E01SBY0okL//z84be7FX7OOU6DngNB/2H2QqeMo MWmIPMw0wgSFMPrJ1cW/j5KMHad5loyzjn3EJBNZr25LEvnsBbiweExYRSc8KuqPrux9ps +yXLqv4EPwk4GI5mjd862eicZB5pzlBY3bggTs5mZNNSIZKNXfMcas5hxIZecdpDfRuntE lgGoBp39zZIMqvpXP9ByV83Qpy9VbxGuQQiDYYP7+8ISc9/04lrlwob6bRG3/Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Q0H5Tkhv; dmarc=pass (policy=none) header.from=posteo.net; 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=1706473984; 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=GJxYDG9pJjpwYam8Eo+M/PFcliuoQhlAiSNB7LiQK6Q=; b=rTnV5ovRkRzF/G+y2FSBCTYdFTgWJtGO+7YXUVQ2JHl2tGs3z6uvvOz4lCMTs/uIiwNAua s1gWa6baS+hpVo2fEtuxjG4Sq19urKa5ieqDQyASK3axMtZTGN0Zk3GRaSMh7wBGp0QDop btlljNpnbjIF60YfGKBthasaFSSIEvRAuJ8cINnNrF8KCsnFZhhwP3W9xfyeuhZ2dJWYFE lqN7cofqzX+sHAToZ4ohzOWEtvM66IBiJvCgtasV6DOLiYgxDyy6Pk1loxPbH5j282e3Ei QfV9gZjt7YP9QcrxdC/s2k0dn9x6iazjsfyWhBm31UkYjVGgXacMd1m7zhzLew== 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 2C9F77C40E for ; Sun, 28 Jan 2024 21:33:04 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUBpI-00037e-NB; Sun, 28 Jan 2024 15:32:24 -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 1rUBp6-00032W-UJ for emacs-orgmode@gnu.org; Sun, 28 Jan 2024 15:32:14 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUBp1-00049K-67 for emacs-orgmode@gnu.org; Sun, 28 Jan 2024 15:32:10 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 97B58240028 for ; Sun, 28 Jan 2024 21:32:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1706473923; bh=euGzSCEHNFewXJSf/R8+MxiP4djWE0L1fmx/mCZ41zs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=Q0H5TkhvzxmngGi28Ilqxoyyk8zQhD49UjZJd8L5Pe7ncgmLUVdeANZ1aIZbwCPqe bZOh19yPaWk6WWWsP+XxPmG79BEWIbexRaCE5yFG/Kx1MlxeYvDRK4zUK7lxC/JzJ+ +LZEzRgxV3C5SDh0Ga5QEOcMUVXjEhmtZXK6AKIXT07IMkBGZocVz14sb10gITxzSJ HcfeF3Fd/1c7hCOwtv/HnKdkTSuOQy+yA/3hOaAFpR7EeS4rpPVysNiCk+CPmkLZsU 5YgNdBkM8Ln9c4yoF1U8nu2u/Oh2VKN2HYKSssNG518p+c5drrNY2HB3hzVS2l/NsN MdTaqUvNecy6g== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TNNQB5NX7z9rxB; Sun, 28 Jan 2024 21:32:02 +0100 (CET) From: Ihor Radchenko To: Liu Hui Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Set Python shell in Org edit buffer In-Reply-To: References: <87zfyosw8n.fsf@localhost> <87ttovlb1u.fsf@localhost> Date: Sun, 28 Jan 2024 20:35:33 +0000 Message-ID: <877cjtnqlm.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, 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-Scanner: mx10.migadu.com X-Spam-Score: -9.88 X-Migadu-Queue-Id: 2C9F77C40E X-Migadu-Spam-Score: -9.88 X-TUID: tjdjTjkJuRxz --=-=-= Content-Type: text/plain Liu Hui writes: > Yes, I have updated the text and you're welcome to improve it. Thanks! > From c503b2ed5116e2abae25459b09abc919074ac54a Mon Sep 17 00:00:00 2001 > From: Liu Hui > Date: Tue, 5 Dec 2023 11:40:38 +0800 > Subject: [PATCH] Set Python shell in Org edit buffer Now, after amending `org-src-associate-babel-session' to execute even when no session is active, we can use `org-babel-python-associate-session'. Attaching tentative patch that should be equivalent to yours. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ob-python-Set-Python-shell-in-Org-edit-buffer.patch >From f8a748aee619f9fa3f9104321b33212447e7f952 Mon Sep 17 00:00:00 2001 Message-ID: From: Ihor Radchenko Date: Sun, 28 Jan 2024 21:29:25 +0100 Subject: [PATCH] ob-python: Set Python shell in Org edit buffer * lisp/ob-python.el (org-babel-python-associate-session): New function setting `python-shell-buffer-name' in *Org Src* buffer according to source block's :session parameter. This function will be triggered by `org-src-associate-babel-session'. * etc/ORG-NEWS (ob-python now sets ~python-shell-buffer-name~ in Org edit buffers): Announce the change. Link: https://orgmode.org/list/CAOQTW-MdC=jiGf+3bEVtfww+izSZix7csBJ+mZ4eZ2BQHDR42w@mail.gmail.com --- etc/ORG-NEWS | 7 +++++++ lisp/ob-python.el | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index f9c916a9d..2163f00e1 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -13,6 +13,13 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org. * Version 9.7 (not released yet) ** Important announcements and breaking changes +*** ob-python now sets ~python-shell-buffer-name~ in Org edit buffers + +When editing a Python src block, the editing buffer is now associated +with the Python shell specified by the src block's ~:session~ header, +which means users can now send code directly from the edit buffer, +e.g., using ~C-c C-c~, to the session specified in the Org buffer. + *** ~org-edit-special~ no longer force-starts session in R and Julia source blocks Previously, when R/Julia source block had =:session= header argument diff --git a/lisp/ob-python.el b/lisp/ob-python.el index 4d7492e2b..2f62d7353 100644 --- a/lisp/ob-python.el +++ b/lisp/ob-python.el @@ -83,6 +83,12 @@ (defcustom org-babel-python-None-to 'hline :package-version '(Org . "8.0") :type 'symbol) +(defun org-babel-python-associate-session (session) + "Associate Python code buffer with an Python session. +Make SESSION without earmuffs be the Python buffer name." + (setq-local python-shell-buffer-name + (org-babel-python-without-earmuffs session))) + (defun org-babel-execute:python (body params) "Execute Python BODY according to PARAMS. This function is called by `org-babel-execute-src-block'." -- 2.43.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--