Prevent ob-python' calling functions bound after loading python'

This commit is contained in:
Gerard Vermeulen 2023-05-15 16:10:51 +02:00
parent 3bd627e095
commit f1f162e7d7

View File

@ -2087,8 +2087,8 @@ list detailing and motivating each listing:
(maxima . ,(fboundp 'maxima-mode))
(org . t)
(perl . t)
;; Postpone Python activation to prevent calling still unbound functions.
(python . nil)
;; Beware: Python activation must not call still unbound functions.
(python . t)
;; MIT/GNU Scheme breaks Babel contrary to Guile, Chez and Chicken Scheme.
(scheme . ,(fboundp 'geiser-mode))
(shell . t))
@ -4944,16 +4944,28 @@ Finally, listing [[lst:flake8-nocolor][flake8-nocolor]] and [[lst:ruff-nocolor][
python-check-command python-flymake-command))))
#+end_src
#+caption[Setup Python mode]:
#+caption: Setup Python mode.
#+caption[Setup Python mode with =ob-python=]:
#+caption: Setup Python mode with =ob-python=.
#+name: lst:setup-python-mode
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ob-python
;; (choose-common-python-interpreter 'python)
(setopt org-babel-python-command (concat (or (executable-find "python3")
(executable-find "python"))
" -E")))
(with-eval-after-load 'python
(setopt python-indent-guess-indent-offset nil
python-shell-completion-native-disabled-interpreters '("ipython3"
"pypy"))
(choose-common-python-interpreter 'python)
(choose-common-python-linter 'ruff-nocolor))
"pypy")
;; (choose-common-python-interpreter 'python)
python-shell-interpreter (or (executable-find "python3")
(executable-find "python"))
python-shell-interpreter-args "-E -i"
;; (choose-common-python-linter 'ruff-nocolor)
python-check-command (executable-find "ruff-nocolor")
python-flymake-command (list (executable-find "ruff-nocolor")
"--stdin-filename" "stdin" "-")))
#+end_src
#+caption[Access =pyenv=]: