From 9490baa8bc203a1c5436e2ca2f4af3138166e72e Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Wed, 26 Oct 2022 12:38:58 +0800 Subject: [PATCH] ob-python: Handle newer version of python-mode.el MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/ob-python.el (py-choose-shell): (py-toggle-shells): Use the new function name. (py-default-interpreter): Remove the variable that is no longer provided by python-mode.el. (org-babel-python-initiate-session-by-key): Use `py-choose-shell'. Reported-by: Christian Köstlin --- lisp/ob-python.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/ob-python.el b/lisp/ob-python.el index 4306634e6..c6f93a609 100644 --- a/lisp/ob-python.el +++ b/lisp/ob-python.el @@ -37,7 +37,7 @@ (require 'python) (declare-function py-shell "ext:python-mode" (&rest args)) -(declare-function py-toggle-shells "ext:python-mode" (arg)) +(declare-function py-choose-shell "ext:python-mode" (&optional shell)) (declare-function py-shell-send-string "ext:python-mode" (strg &optional process)) (defvar org-babel-tangle-lang-exts) @@ -182,7 +182,6 @@ Emacs-lisp table, otherwise return the results as a string." (substring name 1 (- (length name) 1)) name))) -(defvar py-default-interpreter) (defvar py-which-bufname) (defvar python-shell-buffer-name) (defun org-babel-python-initiate-session-by-key (&optional session) @@ -208,7 +207,7 @@ then create. Return the initialized session." ;; Make sure that py-which-bufname is initialized, as otherwise ;; it will be overwritten the first time a Python buffer is ;; created. - (py-toggle-shells py-default-interpreter) + (py-choose-shell) ;; `py-shell' creates a buffer whose name is the value of ;; `py-which-bufname' with '*'s at the beginning and end (let* ((bufname (if (and py-buffer (buffer-live-p py-buffer))