Edit Python section

This commit is contained in:
Gerard Vermeulen 2022-01-04 13:10:26 +01:00
parent 6373530f9e
commit 8887f21b35

View File

@ -1572,18 +1572,40 @@ compatible with [[info:org#Editing Source Code][source code block editing]] whil
[[lst:configure-python]] configures [[https://www.python.org][Python]]. [[lst:configure-python]] configures [[https://www.python.org][Python]].
*** [[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/python.el][Python-mode]] *** [[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/python.el][Python-mode]]
:PROPERTIES:
:CUSTOM_ID: sec:python-mode
:END:
#+caption[Configure =python=]: #+caption[Configure =python=]:
#+caption: Configure =python=. #+caption: Configure =python=.
#+name: lst:configure-python #+name: lst:configure-python
#+begin_src elisp #+begin_src emacs-lisp
(with-eval-after-load 'python (with-eval-after-load 'python
(custom-set-variables (custom-set-variables
'(python-indent-guess-indent-offset nil) '(python-indent-guess-indent-offset nil)
'(python-shell-interpreter-args "-i -E"))) '(python-shell-interpreter-args "-i -E")))
#+end_src #+end_src
*** [[https://github.com/pyenv/pyenv][Pyenv]]
:PROPERTIES:
:CUSTOM_ID: sec:pyenv
:END:
Listing [[lst:enable-pyenv-mode]] configures and enables =pyenv-mode=.
#+caption[Enable =pyenv-mode=]:
#+caption: Enable =pyenv-mode=.
#+name: lst:enable-pyenv-mode
#+begin_src emacs-lisp
(when (and (executable-find "pyenv")
(require 'pyenv-mode nil 'noerror))
(pyenv-mode +1)
(pyenv-mode-set "3.9.9/envs/python-3.9.9"))
#+end_src
*** [[https://github.com/joaotavora/eglot][Eglot]] *** [[https://github.com/joaotavora/eglot][Eglot]]
:PROPERTIES:
:CUSTOM_ID: sec:eglot
:END:
Listing [[lst:configure-eglot-for-python]] configures [[https://github.com/joaotavora/eglot][eglot]] with [[https://github.com/python-lsp/python-lsp-server][python-lsp-server]] Listing [[lst:configure-eglot-for-python]] configures [[https://github.com/joaotavora/eglot][eglot]] with [[https://github.com/python-lsp/python-lsp-server][python-lsp-server]]
for [[https://www.python.org][Python]]. It defines a hook function to launch [[https://github.com/joaotavora/eglot][eglot]] when it sees a proper for [[https://www.python.org][Python]]. It defines a hook function to launch [[https://github.com/joaotavora/eglot][eglot]] when it sees a proper
@ -1689,6 +1711,9 @@ index bf312f6..49e967a 100644
#+end_src #+end_src
*** [[https://github.com/pythonic-emacs/anaconda-mode][Anaconda]] *** [[https://github.com/pythonic-emacs/anaconda-mode][Anaconda]]
:PROPERTIES:
:CUSTOM_ID: sec:anaconda
:END:
Listing [[lst:configure-anaconda-for-python]] configures [[https://github.com/pythonic-emacs/anaconda-mode][anaconda]]. See Listing [[lst:configure-anaconda-for-python]] configures [[https://github.com/pythonic-emacs/anaconda-mode][anaconda]]. See
[[https://github.com/jorgenschaefer/elpy/blob/8d0de310d41ebf06b22321a8534546447456870c/elpy.el#L2775][elpy-module-company]] for how to handle ~company-backends~ as a local variable and [[https://github.com/jorgenschaefer/elpy/blob/8d0de310d41ebf06b22321a8534546447456870c/elpy.el#L2775][elpy-module-company]] for how to handle ~company-backends~ as a local variable and
@ -1748,6 +1773,9 @@ the call to [[info:elisp#Advising Functions][advice-add]] opens Python org-mode
#+end_src #+end_src
*** [[https://jedi.readthedocs.io/en/latest/][Jedi]] *** [[https://jedi.readthedocs.io/en/latest/][Jedi]]
:PROPERTIES:
:CUSTOM_ID: sec:jedi
:END:
Listing [[lst:example-py]] is a [[https://www.python.org][Python]] example to test whether [[https://jedi.readthedocs.io/en/latest/][jedi]] in combination Listing [[lst:example-py]] is a [[https://www.python.org][Python]] example to test whether [[https://jedi.readthedocs.io/en/latest/][jedi]] in combination
with and either [[https://github.com/pythonic-emacs/anaconda-mode][anaconda]] or [[https://github.com/joaotavora/eglot][eglot]] works when coding certain functions of for with and either [[https://github.com/pythonic-emacs/anaconda-mode][anaconda]] or [[https://github.com/joaotavora/eglot][eglot]] works when coding certain functions of for
@ -1767,20 +1795,6 @@ instance [[https://numpy.org/][numpy]] and [[https://scipy.org/][scipy]].
print(q) print(q)
#+end_src #+end_src
*** [[https://github.com/pyenv/pyenv][Pyenv]]
Listing [[lst:enable-pyenv-mode]] configures and enables =pyenv-mode=.
#+caption[Enable =pyenv-mode=]:
#+caption: Enable =pyenv-mode=.
#+name: lst:enable-pyenv-mode
#+begin_src emacs-lisp
(when (and (executable-find "pyenv")
(require 'pyenv-mode nil 'noerror))
(pyenv-mode +1)
(pyenv-mode-set "3.9.9/envs/python-3.9.9"))
#+end_src
*** Info *** Info
Listing [[lst:configure-info]] adds a path in my home directory to the places where Listing [[lst:configure-info]] adds a path in my home directory to the places where