From c8b9c174cf643bd625cedc311d2604e6fc3bb83a 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 * lisp/ob-python.el (org-babel-edit-prep:python): New function. --- lisp/ob-python.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/ob-python.el b/lisp/ob-python.el index 6c568a36d..8ff2c7a1d 100644 --- a/lisp/ob-python.el +++ b/lisp/ob-python.el @@ -67,6 +67,13 @@ (defcustom org-babel-python-None-to 'hline :package-version '(Org . "8.0") :type 'symbol) +(defun org-babel-edit-prep:python (info) + "Set Python shell in Org edit buffer according to INFO." + (let ((session (cdr (assq :session (nth 2 info))))) + (when (and session (not (string= session "none"))) + (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.25.1