diff --git a/etc/NEWS b/etc/NEWS index aaf3783f006..c8a1e75d68f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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 diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 39efeaf9122..d4a213466f3 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -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"