297
297
298
298
(defcustom python-interpreter "python"
299
299
"Python interpreter for noninteractive use.
300
- To customize the Python shell, modify `python-shell-interpreter'
301
- instead."
300
+ Some Python interpreters also require changes to
301
+ `python-interpreter-args'.
302
+
303
+ To customize the Python interpreter for interactive use, modify
304
+ `python-shell-interpreter' instead."
302
305
:version "29.1"
303
306
:type 'string)
304
307
308
+ (defcustom python-interpreter-args ""
309
+ "Arguments for the Python interpreter for noninteractive use."
310
+ :version "30.1"
311
+ :type 'string)
305
312
306
313
307
314
;;; Bindings
@@ -2558,7 +2565,7 @@ position, else returns nil."
2558
2565
(cond ((executable-find "python3") "python3")
2559
2566
((executable-find "python") "python")
2560
2567
(t "python3"))
2561
- "Default Python interpreter for shell .
2568
+ "Python interpreter for interactive use .
2562
2569
2563
2570
Some Python interpreters also require changes to
2564
2571
`python-shell-interpreter-args'. In particular, setting
@@ -2573,11 +2580,12 @@ Some Python interpreters also require changes to
2573
2580
:safe 'stringp)
2574
2581
2575
2582
(defcustom python-shell-interpreter-args "-i"
2576
- "Default arguments for the Python interpreter."
2583
+ "Arguments for the Python interpreter for interactive use ."
2577
2584
:type 'string)
2578
2585
2579
2586
(defcustom python-shell-interpreter-interactive-arg "-i"
2580
- "Interpreter argument to force it to run interactively."
2587
+ "Interpreter argument to force it to run interactively.
2588
+ This is used only for prompt detection."
2581
2589
:type 'string
2582
2590
:version "24.4")
2583
2591
@@ -6505,18 +6513,25 @@ recursively."
6505
6513
(let* ((temp (current-buffer))
6506
6514
(status (if (bufferp source)
6507
6515
(with-current-buffer source
6508
- (call-process-region (point-min) (point-max)
6509
- python-interpreter
6510
- nil (list temp nil) nil
6511
- "-c" python--list-imports
6512
- (or name "")))
6516
+ (apply #'call-process-region
6517
+ (point-min) (point-max)
6518
+ python-interpreter
6519
+ nil (list temp nil) nil
6520
+ (append
6521
+ (split-string-shell-command
6522
+ python-interpreter-args)
6523
+ `("-c" ,python--list-imports)
6524
+ (list (or name "")))))
6513
6525
(with-current-buffer buffer
6514
6526
(apply #'call-process
6515
6527
python-interpreter
6516
6528
nil (list temp nil) nil
6517
- "-c" python--list-imports
6518
- (or name "")
6519
- (mapcar #'file-local-name source)))))
6529
+ (append
6530
+ (split-string-shell-command
6531
+ python-interpreter-args)
6532
+ `("-c" ,python--list-imports)
6533
+ (list (or name ""))
6534
+ (mapcar #'file-local-name source))))))
6520
6535
lines)
6521
6536
(python--list-imports-check-status status)
6522
6537
(goto-char (point-min))
@@ -6559,7 +6574,11 @@ Return non-nil if the buffer was actually modified."
6559
6574
(point-min) (point-max)
6560
6575
python-interpreter
6561
6576
nil (list temp nil) nil
6562
- "-m" "isort" "-" args))
6577
+ (append
6578
+ (split-string-shell-command
6579
+ python-interpreter-args)
6580
+ '("-m" "isort" "-")
6581
+ args)))
6563
6582
(tick (buffer-chars-modified-tick)))
6564
6583
(unless (eq 0 status)
6565
6584
(error "%s exited with status %s (maybe isort is missing?)"
@@ -6629,10 +6648,14 @@ asking."
6629
6648
(with-temp-buffer
6630
6649
(let ((temp (current-buffer)))
6631
6650
(with-current-buffer buffer
6632
- (call-process-region (point-min) (point-max)
6633
- python-interpreter
6634
- nil temp nil
6635
- "-m" "pyflakes"))
6651
+ (apply #'call-process-region
6652
+ (point-min) (point-max)
6653
+ python-interpreter
6654
+ nil temp nil
6655
+ (append
6656
+ (split-string-shell-command
6657
+ python-interpreter-args)
6658
+ '("-m" "pyflakes"))))
6636
6659
(goto-char (point-min))
6637
6660
(when (looking-at-p ".* No module named pyflakes$")
6638
6661
(error "%s couldn't find pyflakes" python-interpreter))
0 commit comments