1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00

Try "python" before "python3" in python-mode

Prefer whatever version of Python that "python" might point to; use
"python3" if it doesn't exist.  On recent versions of typical GNU/Linux
distributions, "python" either does not exist or it points to Python 3.
In (presumed rare) cases where "python" points to Python 2 instead,
users are now expected to manually customize these variables if they
want to use Python 3.

* lisp/progmodes/python.el (python-interpreter)
(python-shell-interpreter): Prefer "python" to "python3".

Ref:
https://lists.gnu.org/r/emacs-devel/2024-09/msg00885.html
This commit is contained in:
Stefan Kangas 2024-09-29 23:29:54 +02:00
parent 4003d5f126
commit dd4c67907e
2 changed files with 16 additions and 5 deletions

View File

@ -444,6 +444,17 @@ toggle.
Putting (require 'midnight) in your init file no longer activates the
mode. Now, one needs to say (midnight-mode +1) instead.
** Python mode
---
*** Prefer "python" for 'python-interpreter' and 'python-shell-interpreter'.
On recent versions of mainstream GNU/Linux distributions, "python"
either does not exist or it points to Python 3. These user options now
default to using "python", falling back to "python3" if it does not
exist. If "python" points to Python 2 on your system, you now have to
customize these variables to "python3" if you want to use Python 3
instead.
* New Modes and Packages in Emacs 31.1

View File

@ -313,8 +313,8 @@
:link '(emacs-commentary-link "python"))
(defcustom python-interpreter
(cond ((executable-find "python3") "python3")
((executable-find "python") "python")
(cond ((executable-find "python") "python")
((executable-find "python3") "python3")
(t "python3"))
"Python interpreter for noninteractive use.
Some Python interpreters also require changes to
@ -2739,8 +2739,8 @@ position, else returns nil."
:safe 'stringp)
(defcustom python-shell-interpreter
(cond ((executable-find "python3") "python3")
((executable-find "python") "python")
(cond ((executable-find "python") "python")
((executable-find "python3") "python3")
(t "python3"))
"Python interpreter for interactive use.
@ -2748,7 +2748,7 @@ Some Python interpreters also require changes to
`python-shell-interpreter-args'. In particular, setting
`python-shell-interpreter' to \"ipython3\" requires setting
`python-shell-interpreter-args' to \"--simple-prompt\"."
:version "28.1"
:version "31.1"
:type 'string)
(defcustom python-shell-internal-buffer-name "Python Internal"