[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64397: 29.0.91; Limited configuration of commands based on python-in
From: |
Matthias Meulien |
Subject: |
bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter |
Date: |
Sat, 01 Jul 2023 18:10:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Here's a patch adding a python-interpreter-args custom variable.
>From 729e8892c129c2f3c6dfd0f119259d586fe11118 Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Sat, 1 Jul 2023 16:07:01 +0200
Subject: [PATCH] Custom var python-interpreter-args (bug#64397)
* lisp/progmodes/python.el (python-interpreter): Mention new variable
in documentation.
(python-interpreter-args): New custom variable.
(python--list-imports, python--do-isort, python-fix-imports): Make
process use customisable arguments.
---
lisp/progmodes/python.el | 50 +++++++++++++++++++++++++++++-----------
1 file changed, 36 insertions(+), 14 deletions(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 50d712ebb0c..ef6da75a1c1 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -297,11 +297,18 @@ python
(defcustom python-interpreter "python"
"Python interpreter for noninteractive use.
+
+Some Python interpreters also require changes to
+`python-interpreter-args'.
+
To customize the Python shell, modify `python-shell-interpreter'
instead."
:version "29.1"
:type 'string)
+(defcustom python-interpreter-args ""
+ "Default arguments for the Python interpreter."
+ :type 'string)
;;; Bindings
@@ -2573,7 +2580,7 @@ python-shell-internal-buffer-name
:safe 'stringp)
(defcustom python-shell-interpreter-args "-i"
- "Default arguments for the Python interpreter."
+ "Default arguments for the Python interpreter for shell."
:type 'string)
(defcustom python-shell-interpreter-interactive-arg "-i"
@@ -6488,18 +6495,25 @@ python--list-imports
(let* ((temp (current-buffer))
(status (if (bufferp source)
(with-current-buffer source
- (call-process-region (point-min) (point-max)
- python-interpreter
- nil (list temp nil) nil
- "-c" python--list-imports
- (or name "")))
+ (apply #'call-process-region
+ (point-min) (point-max)
+ python-interpreter
+ nil (list temp nil) nil
+ (append
+ (split-string-shell-command
+ python-interpreter-args)
+ `("-c" ,python--list-imports)
+ (list (or name "")))))
(with-current-buffer buffer
(apply #'call-process
python-interpreter
nil (list temp nil) nil
- "-c" python--list-imports
- (or name "")
- (mapcar #'file-local-name source)))))
+ (append
+ (split-string-shell-command
+ python-interpreter-args)
+ `("-c" ,python--list-imports)
+ (list (or name ""))
+ (mapcar #'file-local-name source))))))
lines)
(unless (eq 0 status)
(error "%s exited with status %s (maybe isort is missing?)"
@@ -6544,7 +6558,11 @@ python--do-isort
(point-min) (point-max)
python-interpreter
nil (list temp nil) nil
- "-m" "isort" "-" args))
+ (append
+ (split-string-shell-command
+ python-interpreter-args)
+ '("-m" "isort" "-")
+ args)))
(tick (buffer-chars-modified-tick)))
(unless (eq 0 status)
(error "%s exited with status %s (maybe isort is missing?)"
@@ -6614,10 +6632,14 @@ python-fix-imports
(with-temp-buffer
(let ((temp (current-buffer)))
(with-current-buffer buffer
- (call-process-region (point-min) (point-max)
- python-interpreter
- nil temp nil
- "-m" "pyflakes"))
+ (apply #'call-process-region
+ (point-min) (point-max)
+ python-interpreter
+ nil temp nil
+ (append
+ (split-string-shell-command
+ python-interpreter-args)
+ '("-m" "pyflakes"))))
(goto-char (point-min))
(when (looking-at-p ".* No module named pyflakes$")
(error "%s couldn't find pyflakes" python-interpreter))
--
2.39.2
--
Matthias
- bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter, Matthias Meulien, 2023/07/01
- bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter,
Matthias Meulien <=
- bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter, Eli Zaretskii, 2023/07/06
- bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter, Matthias Meulien, 2023/07/06
- bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter, Eli Zaretskii, 2023/07/08
- bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter, kobarity, 2023/07/08
- bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter, Eli Zaretskii, 2023/07/08
- bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter, Matthias Meulien, 2023/07/08
- bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter, kobarity, 2023/07/09
- bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter, Eli Zaretskii, 2023/07/13