aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2024-09-29 23:29:54 +0200
committerStefan Kangas2024-09-29 23:39:54 +0200
commitdd4c67907eb3084c6f55828c51bca1675a98376d (patch)
tree950772b6a0be54eb88793f5cb2aee427b0b27e32
parent4003d5f12673d243d2cf5e36f6d124d166cc96be (diff)
downloademacs-dd4c67907eb3084c6f55828c51bca1675a98376d.tar.gz
emacs-dd4c67907eb3084c6f55828c51bca1675a98376d.zip
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
-rw-r--r--etc/NEWS11
-rw-r--r--lisp/progmodes/python.el10
2 files changed, 16 insertions, 5 deletions
diff --git a/etc/NEWS b/etc/NEWS
index aaf3783f006..c8a1e75d68f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -444,6 +444,17 @@ toggle.
444Putting (require 'midnight) in your init file no longer activates the 444Putting (require 'midnight) in your init file no longer activates the
445mode. Now, one needs to say (midnight-mode +1) instead. 445mode. Now, one needs to say (midnight-mode +1) instead.
446 446
447** Python mode
448
449---
450*** Prefer "python" for 'python-interpreter' and 'python-shell-interpreter'.
451On recent versions of mainstream GNU/Linux distributions, "python"
452either does not exist or it points to Python 3. These user options now
453default to using "python", falling back to "python3" if it does not
454exist. If "python" points to Python 2 on your system, you now have to
455customize these variables to "python3" if you want to use Python 3
456instead.
457
447 458
448* New Modes and Packages in Emacs 31.1 459* New Modes and Packages in Emacs 31.1
449 460
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 @@
313 :link '(emacs-commentary-link "python")) 313 :link '(emacs-commentary-link "python"))
314 314
315(defcustom python-interpreter 315(defcustom python-interpreter
316 (cond ((executable-find "python3") "python3") 316 (cond ((executable-find "python") "python")
317 ((executable-find "python") "python") 317 ((executable-find "python3") "python3")
318 (t "python3")) 318 (t "python3"))
319 "Python interpreter for noninteractive use. 319 "Python interpreter for noninteractive use.
320Some Python interpreters also require changes to 320Some Python interpreters also require changes to
@@ -2739,8 +2739,8 @@ position, else returns nil."
2739 :safe 'stringp) 2739 :safe 'stringp)
2740 2740
2741(defcustom python-shell-interpreter 2741(defcustom python-shell-interpreter
2742 (cond ((executable-find "python3") "python3") 2742 (cond ((executable-find "python") "python")
2743 ((executable-find "python") "python") 2743 ((executable-find "python3") "python3")
2744 (t "python3")) 2744 (t "python3"))
2745 "Python interpreter for interactive use. 2745 "Python interpreter for interactive use.
2746 2746
@@ -2748,7 +2748,7 @@ Some Python interpreters also require changes to
2748`python-shell-interpreter-args'. In particular, setting 2748`python-shell-interpreter-args'. In particular, setting
2749`python-shell-interpreter' to \"ipython3\" requires setting 2749`python-shell-interpreter' to \"ipython3\" requires setting
2750`python-shell-interpreter-args' to \"--simple-prompt\"." 2750`python-shell-interpreter-args' to \"--simple-prompt\"."
2751 :version "28.1" 2751 :version "31.1"
2752 :type 'string) 2752 :type 'string)
2753 2753
2754(defcustom python-shell-internal-buffer-name "Python Internal" 2754(defcustom python-shell-internal-buffer-name "Python Internal"