all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
@ 2023-07-01  6:33 Matthias Meulien
  2023-07-01 16:10 ` Matthias Meulien
  0 siblings, 1 reply; 16+ messages in thread
From: Matthias Meulien @ 2023-07-01  6:33 UTC (permalink / raw)
  To: 64397


In Python projects managed using the popular Poetry dependency manager,
I use 'poetry run python' as Python shell interpreter; It ensures all
Python interaction happens in a virtual environment where development
dependencies are installed.

In Emacs, I set `python-shell-interpreter' to "poetry" and
`python-shell-interpreter-args' to "run python" through directory local
variables at the root of my Python projects.  And everything works as
expected: No environment variable to set, no script to call, but each
project has its own interpreter using dedicated dependencies,
etc.. Great!

Alas `python-sort-imports' and related commands use `python-interpreter'
which doesn't have an "-args" variable. But `python-sort-imports' rely
on external Python libraries being installed (like isort).  I don't want
to install such library globally (they're already available in the
project virtual environment as dependencies of the lsp server).

To make `python-interpreter' use the virtual environment provided by
Poetry one would need a `python-interpreter-args' custom variable.  I'd
like to add such a variable.  Any comments?  Is it the right way to
solve my problem?



In GNU Emacs 29.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.37, cairo version 1.16.0) of 2023-06-13 built on carbon
Repository revision: 212884f2bfed7f00e58aad183edd20ecc2a23e71
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-json --with-native-compilation --with-x-toolkit=gtk
 --with-tree-sitter'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2
XPM GTK3 ZLIB

Important settings:
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  gnus-topic-mode: t
  shell-dirtrack-mode: t
  highlight-changes-visible-mode: t
  breadcrumb-mode: t
  minions-mode: t
  global-company-mode: t
  company-mode: t
  gnus-undo-mode: t
  desktop-save-mode: t
  server-mode: t
  pixel-scroll-precision-mode: t
  save-place-mode: t
  electric-pair-mode: t
  icomplete-mode: t
  global-so-long-mode: t
  global-auto-revert-mode: t
  auto-insert-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-layout-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/matthias/.config/emacs/elpa/jsonrpc-1.0.17/jsonrpc hides /usr/local/share/emacs/29.0.91/lisp/jsonrpc
/home/matthias/.config/emacs/elpa/flymake-1.3.4/flymake hides /usr/local/share/emacs/29.0.91/lisp/progmodes/flymake
/home/matthias/.config/emacs/elpa/project-0.9.8/project hides /usr/local/share/emacs/29.0.91/lisp/progmodes/project
/home/matthias/.config/emacs/elpa/eglot-1.15/eglot hides /usr/local/share/emacs/29.0.91/lisp/progmodes/eglot
/home/matthias/.config/emacs/elpa/dictionary-20201001.1727/dictionary hides /usr/local/share/emacs/29.0.91/lisp/net/dictionary
/home/matthias/.config/emacs/elpa/soap-client-3.2.3/soap-client hides /usr/local/share/emacs/29.0.91/lisp/net/soap-client
/home/matthias/.config/emacs/elpa/soap-client-3.2.3/soap-inspect hides /usr/local/share/emacs/29.0.91/lisp/net/soap-inspect
/home/matthias/.config/emacs/elpa/eldoc-1.14.0/eldoc hides /usr/local/share/emacs/29.0.91/lisp/emacs-lisp/eldoc

Features:
(shadow sort gnus-cite mail-extr emacsbug gnus-topic nndraft nnmh
nnfolder utf-7 epa-file network-stream nsm gnus-agent gnus-srvr
gnus-score score-mode nnvirtual gnus-msg gnus-cache dabbrev shortdoc
tabify cus-start cl-print help-fns radix-tree mhtml-mode hideshow
cap-words superword subword css-mode js c-ts-common make-mode follow
mule-util yaml-mode rst smerge-mode diff rng-xsd xsd-regexp rng-cmpct
rng-nxml rng-valid nxml-mode nxml-outln nxml-rap sgml-mode facemenu
add-log sh-script smie executable files-x shell vc-hg vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs log-view pcvs-util misearch multi-isearch
image-dired image-dired-tags image-dired-external image-dired-util man
hl-line dired-aux conf-mode flyspell ox-odt rng-loc rng-uri rng-parse
rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok
nxml-util ox-latex ox-icalendar org-agenda ox-html table ox-ascii
ox-publish ox oc-basic org-element org-persist org-id avl-tree ol-eww
eww xdg url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr
pixel-fill kinsoku url-file svg dom ol-docview doc-view image-mode exif
ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi vc-dir vc goto-addr
jka-compr display-line-numbers hilit-chg eglot external-completion
jsonrpc flymake-proc flymake ert ewoc debug backtrace compile breadcrumb
imenu company-oddmuse company-keywords company-etags etags fileloop
generator xref company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-capf company-cmake company-semantic
company-template company-bbdb ob-python python project treesit minions
compat company pcase carbon-custom cus-edit cus-load gnus-demon nntp
gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap
nnmail mail-source utf7 parse-time iso8601 gnus-spec gnus-win nnoo
gnus-int gnus-range message sendmail yank-media puny rfc822 mml mml-sec
epa derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils
mailheader gnus nnheader gnus-util mail-utils range mm-util mail-prsvr
wid-edit gnus-dired dired-x dired dired-loaddefs org-capture org-refile
org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src
ob-comint org-pcomplete pcomplete comint ansi-osc ansi-color org-list
org-footnote org-faces org-entities time-date ob-emacs-lisp ob-core
ob-eval org-cycle org-table ol org-fold org-fold-core org-keys oc
org-loaddefs find-func cal-menu calendar cal-loaddefs org-compat
org-version org-macs format-spec dictionary link connection advice
markdown-mode color thingatpt noutline outline skeleton find-file vc-git
diff-mode easy-mmode vc-dispatcher ispell comp comp-cstr warnings icons
rx cl-extra help-mode desktop frameset server bookmark
text-property-search pp pixel-scroll cua-base ring saveplace elec-pair
icomplete so-long autorevert filenotify autoinsert cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
generic-x face-remap yasnippet-snippets-autoloads git-link-autoloads
flymake-easy-autoloads proof-general-autoloads proof-site
proof-autoloads debbugs-autoloads minions-autoloads compat-autoloads
markdown-mode-autoloads typescript-mode-autoloads soap-client-autoloads
breadcrumb-autoloads yaml-mode-autoloads dockerfile-mode-autoloads
terraform-mode-autoloads hcl-mode-autoloads restclient-jq-autoloads
restclient-autoloads dash-autoloads eglot-autoloads jsonrpc-autoloads
company-autoloads caml-autoloads jq-mode-autoloads csv-mode-autoloads
info mmm-mode-autoloads yaml-autoloads rfc-mode-autoloads
mallard-mode-autoloads go-mode-autoloads flymake-autoloads
project-autoloads eldoc-autoloads package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 791656 86540)
 (symbols 48 41142 1)
 (strings 32 189966 5117)
 (string-bytes 1 6010657)
 (vectors 16 84791)
 (vector-slots 8 2369682 33963)
 (floats 8 728 451)
 (intervals 56 12747 4282)
 (buffers 984 121))

-- 
Matthias





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-01  6:33 bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter Matthias Meulien
@ 2023-07-01 16:10 ` Matthias Meulien
  2023-07-06  7:21   ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Matthias Meulien @ 2023-07-01 16:10 UTC (permalink / raw)
  To: 64397

[-- Attachment #1: Type: text/plain, Size: 67 bytes --]


Here's a patch adding a python-interpreter-args custom variable.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Custom-var-python-interpreter-args-bug-64397.patch --]
[-- Type: text/x-diff, Size: 4937 bytes --]

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)
 
 \f
 ;;; 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


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
Matthias

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-01 16:10 ` Matthias Meulien
@ 2023-07-06  7:21   ` Eli Zaretskii
  2023-07-06 14:51     ` kobarity
  2023-07-06 20:39     ` Matthias Meulien
  0 siblings, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2023-07-06  7:21 UTC (permalink / raw)
  To: Matthias Meulien, kobarity; +Cc: 64397

> From: Matthias Meulien <orontee@gmail.com>
> Date: Sat, 01 Jul 2023 18:10:21 +0200
> 
> Here's a patch adding a python-interpreter-args custom variable.

Thanks.  A few minor comments below.

> +(defcustom python-interpreter-args ""
> +  "Default arguments for the Python interpreter."
> +  :type 'string)

New defcustoms should have the :version tag.

>  (defcustom python-shell-interpreter-args "-i"
> -  "Default arguments for the Python interpreter."
> +  "Default arguments for the Python interpreter for shell."

I think this doc string needs to be clarified, in particular what is
the significance of the "for shell" addition.

We also need a NEWS entry calling out the new defcustom.

kobarity, any comments to this change?  See the description of the
original issue in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64397#5.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-06  7:21   ` Eli Zaretskii
@ 2023-07-06 14:51     ` kobarity
  2023-07-07  8:09       ` Augusto Stoffel
  2023-07-06 20:39     ` Matthias Meulien
  1 sibling, 1 reply; 16+ messages in thread
From: kobarity @ 2023-07-06 14:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Matthias Meulien, Augusto Stoffel, 64397


Eli Zaretskii wrote:
> 
> > From: Matthias Meulien <orontee@gmail.com>
> > Date: Sat, 01 Jul 2023 18:10:21 +0200
> > 
> > Here's a patch adding a python-interpreter-args custom variable.
> 
> Thanks.  A few minor comments below.
> 
> > +(defcustom python-interpreter-args ""
> > +  "Default arguments for the Python interpreter."
> > +  :type 'string)
> 
> New defcustoms should have the :version tag.
> 
> >  (defcustom python-shell-interpreter-args "-i"
> > -  "Default arguments for the Python interpreter."
> > +  "Default arguments for the Python interpreter for shell."
> 
> I think this doc string needs to be clarified, in particular what is
> the significance of the "for shell" addition.
> 
> We also need a NEWS entry calling out the new defcustom.
> 
> kobarity, any comments to this change?  See the description of the
> original issue in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64397#5.

I think it is reasonable, but I would like to hear the opinion of
Augusto Stoffel who created the Import management.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-06  7:21   ` Eli Zaretskii
  2023-07-06 14:51     ` kobarity
@ 2023-07-06 20:39     ` Matthias Meulien
  2023-07-08  7:52       ` Eli Zaretskii
  1 sibling, 1 reply; 16+ messages in thread
From: Matthias Meulien @ 2023-07-06 20:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: kobarity, 64397

[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Matthias Meulien <orontee@gmail.com>
>> Date: Sat, 01 Jul 2023 18:10:21 +0200
>> 
>> Here's a patch adding a python-interpreter-args custom variable.
>
> Thanks.  A few minor comments below.
>
>> +(defcustom python-interpreter-args ""
>> +  "Default arguments for the Python interpreter."
>> +  :type 'string)
>
> New defcustoms should have the :version tag.
>
>>  (defcustom python-shell-interpreter-args "-i"
>> -  "Default arguments for the Python interpreter."
>> +  "Default arguments for the Python interpreter for shell."
>
> I think this doc string needs to be clarified, in particular what is
> the significance of the "for shell" addition.
>
> We also need a NEWS entry calling out the new defcustom.
>
> kobarity, any comments to this change?  See the description of the
> original issue in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64397#5.

Thanks for your careful reading.

Here is an updated patch.

Not sure it address your very relevant comment on the doc string of
python-shell-interpreter-args.  I must confess I don't understand the
meaning of the word "shell" in this file python-mode.el (even after
reading https://en.wikipedia.org/wiki/Shell_(computing))!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Custom-var-python-interpreter-args-bug-64397.patch --]
[-- Type: text/x-diff, Size: 5647 bytes --]

From d56ab4c8fc8979dc5f07f40c2c0d87b336a09593 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.
---
 etc/NEWS                 |  4 +++
 lisp/progmodes/python.el | 53 ++++++++++++++++++++++++++++------------
 2 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 1a86c9e55e2..46eab6c38bc 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -383,6 +383,10 @@ instead of:
         and another_expression):
         do_something()
 
+*** New user option 'python-interpreter-args'.
+This allows the user to specify command line arguments to the non
+interactive Python interpreter specified by 'python-interpreter'.
+
 ** use-package
 
 +++
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 4291ab03ca6..4d5bcfcaa49 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -297,11 +297,19 @@ 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."
+  :version "30.1"
+  :type 'string)
 
 \f
 ;;; Bindings
@@ -2558,7 +2566,7 @@ python-shell-interpreter
   (cond ((executable-find "python3") "python3")
         ((executable-find "python") "python")
         (t "python3"))
-  "Default Python interpreter for shell.
+  "Default Python interpreter used for user interactions.
 
 Some Python interpreters also require changes to
 `python-shell-interpreter-args'.  In particular, setting
@@ -2573,7 +2581,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"
@@ -6494,18 +6502,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)
         (cond
          ((eq 1 status)
@@ -6554,7 +6569,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)))
             (cond
              ((eq 1 status)
@@ -6628,10 +6647,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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-06 14:51     ` kobarity
@ 2023-07-07  8:09       ` Augusto Stoffel
  0 siblings, 0 replies; 16+ messages in thread
From: Augusto Stoffel @ 2023-07-07  8:09 UTC (permalink / raw)
  To: kobarity; +Cc: Eli Zaretskii, Matthias Meulien, 64397

On Thu,  6 Jul 2023 at 23:51, kobarity wrote:

> I think it is reasonable, but I would like to hear the opinion of
> Augusto Stoffel who created the Import management.

Also looks reasonable to me.

I personally would do some things differently: I would rather allow
`python-interpreter' to be a list of strings (e.g. '("poetry" "run"))
instead of adding a new variable `python-interpreter-args'.  Or else I
would make `python-interpreter-args' a list of strings instead of a
string that needs to be split according to arcane shell rules.

But I guess the current patch is more consistent with other conventions
of python.el.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-06 20:39     ` Matthias Meulien
@ 2023-07-08  7:52       ` Eli Zaretskii
  2023-07-08 11:28         ` kobarity
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2023-07-08  7:52 UTC (permalink / raw)
  To: Matthias Meulien; +Cc: kobarity, 64397

> From: Matthias Meulien <orontee@gmail.com>
> Cc: kobarity <kobarity@gmail.com>,  64397@debbugs.gnu.org
> Date: Thu, 06 Jul 2023 22:39:34 +0200
> 
> Not sure it address your very relevant comment on the doc string of
> python-shell-interpreter-args.  I must confess I don't understand the
> meaning of the word "shell" in this file python-mode.el (even after
> reading https://en.wikipedia.org/wiki/Shell_(computing))!

Then how about leaving the doc string of python-shell-interpreter-args
as it was before?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-08  7:52       ` Eli Zaretskii
@ 2023-07-08 11:28         ` kobarity
  2023-07-08 13:50           ` Eli Zaretskii
  2023-07-08 16:28           ` Matthias Meulien
  0 siblings, 2 replies; 16+ messages in thread
From: kobarity @ 2023-07-08 11:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Augusto Stoffel, Matthias Meulien, 64397


Eli Zaretskii wrote:
> 
> > From: Matthias Meulien <orontee@gmail.com>
> > Cc: kobarity <kobarity@gmail.com>,  64397@debbugs.gnu.org
> > Date: Thu, 06 Jul 2023 22:39:34 +0200
> > 
> > Not sure it address your very relevant comment on the doc string of
> > python-shell-interpreter-args.  I must confess I don't understand the
> > meaning of the word "shell" in this file python-mode.el (even after
> > reading https://en.wikipedia.org/wiki/Shell_(computing))!
> 
> Then how about leaving the doc string of python-shell-interpreter-args
> as it was before?

This may be a good opportunity to clarify the docstrings.  The current
short descriptions are a bit inconsistent.

python-interpreter
  Python interpreter for noninteractive use.
python-shell-interpreter
  Default Python interpreter for shell.
python-shell-interpreter-args
  Default arguments for the Python interpreter.

In python.el, Python Shell just means the interactive Python
interpreter (or REPL) invoked by C-c C-p (M-x run-python).
python-interpreter is added in Emacs 29 to call Python
non-interactively.  How about the following descriptions?

python-interpreter
  Python interpreter for noninteractive use.
python-interpreter-args
  Arguments for the Python interpreter for noninteractive use.
python-shell-interpreter
  Python interpreter for interactive use.
python-shell-interpreter-args
  Arguments for the Python interpreter for interactive use.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-08 11:28         ` kobarity
@ 2023-07-08 13:50           ` Eli Zaretskii
  2023-07-08 16:28           ` Matthias Meulien
  1 sibling, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2023-07-08 13:50 UTC (permalink / raw)
  To: kobarity; +Cc: arstoffel, orontee, 64397

> Date: Sat, 08 Jul 2023 20:28:36 +0900
> From: kobarity <kobarity@gmail.com>
> Cc: Matthias Meulien <orontee@gmail.com>,
> 	Augusto Stoffel <arstoffel@gmail.com>,
> 	64397@debbugs.gnu.org
> 
> python-interpreter
>   Python interpreter for noninteractive use.
> python-interpreter-args
>   Arguments for the Python interpreter for noninteractive use.
> python-shell-interpreter
>   Python interpreter for interactive use.
> python-shell-interpreter-args
>   Arguments for the Python interpreter for interactive use.

LGTM, thanks.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-08 11:28         ` kobarity
  2023-07-08 13:50           ` Eli Zaretskii
@ 2023-07-08 16:28           ` Matthias Meulien
  2023-07-09 12:17             ` kobarity
  1 sibling, 1 reply; 16+ messages in thread
From: Matthias Meulien @ 2023-07-08 16:28 UTC (permalink / raw)
  To: kobarity; +Cc: Eli Zaretskii, Augusto Stoffel, 64397

kobarity <kobarity@gmail.com> writes:

> (...) How about the following descriptions?
>
> python-interpreter
>   Python interpreter for noninteractive use.
> python-interpreter-args
>   Arguments for the Python interpreter for noninteractive use.
> python-shell-interpreter
>   Python interpreter for interactive use.
> python-shell-interpreter-args
>   Arguments for the Python interpreter for interactive use.

I like it.  But you skipped python-shell-interpreter-interactive-arg...





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-08 16:28           ` Matthias Meulien
@ 2023-07-09 12:17             ` kobarity
  2023-07-13  5:50               ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: kobarity @ 2023-07-09 12:17 UTC (permalink / raw)
  To: Matthias Meulien; +Cc: Eli Zaretskii, Augusto Stoffel, 64397


Matthias Meulien wrote:
> 
> kobarity <kobarity@gmail.com> writes:
> 
> > (...) How about the following descriptions?
> >
> > python-interpreter
> >   Python interpreter for noninteractive use.
> > python-interpreter-args
> >   Arguments for the Python interpreter for noninteractive use.
> > python-shell-interpreter
> >   Python interpreter for interactive use.
> > python-shell-interpreter-args
> >   Arguments for the Python interpreter for interactive use.
> 
> I like it.  But you skipped python-shell-interpreter-interactive-arg...

Sorry, I forgot about that.
`python-shell-interpreter-interactive-arg' is used only for prompt
detection, and its docstring has only one line:

Interpreter argument to force it to run interactively.

I think we can leave it as is, but if we want to improve it, how about
adding the second line?  I could not shorten it to fit on one line.

Interpreter argument to force it to run interactively.
This is used only for prompt detection.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-09 12:17             ` kobarity
@ 2023-07-13  5:50               ` Eli Zaretskii
  2023-07-13 21:44                 ` Matthias Meulien
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2023-07-13  5:50 UTC (permalink / raw)
  To: orontee, kobarity; +Cc: arstoffel, 64397

> Date: Sun, 09 Jul 2023 21:17:48 +0900
> From: kobarity <kobarity@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,
> 	Augusto Stoffel <arstoffel@gmail.com>,
> 	64397@debbugs.gnu.org
> 
> 
> Matthias Meulien wrote:
> > 
> > kobarity <kobarity@gmail.com> writes:
> > 
> > > (...) How about the following descriptions?
> > >
> > > python-interpreter
> > >   Python interpreter for noninteractive use.
> > > python-interpreter-args
> > >   Arguments for the Python interpreter for noninteractive use.
> > > python-shell-interpreter
> > >   Python interpreter for interactive use.
> > > python-shell-interpreter-args
> > >   Arguments for the Python interpreter for interactive use.
> > 
> > I like it.  But you skipped python-shell-interpreter-interactive-arg...
> 
> Sorry, I forgot about that.
> `python-shell-interpreter-interactive-arg' is used only for prompt
> detection, and its docstring has only one line:
> 
> Interpreter argument to force it to run interactively.
> 
> I think we can leave it as is, but if we want to improve it, how about
> adding the second line?  I could not shorten it to fit on one line.
> 
> Interpreter argument to force it to run interactively.
> This is used only for prompt detection.

Thanks.

Matthias, can you post an updated patch where the last comments about
doc strings are taken care of?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-13  5:50               ` Eli Zaretskii
@ 2023-07-13 21:44                 ` Matthias Meulien
  2023-07-15  8:30                   ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Matthias Meulien @ 2023-07-13 21:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: kobarity, arstoffel, 64397

[-- Attachment #1: Type: text/plain, Size: 1429 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Sun, 09 Jul 2023 21:17:48 +0900
>> From: kobarity <kobarity@gmail.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>,
>> 	Augusto Stoffel <arstoffel@gmail.com>,
>> 	64397@debbugs.gnu.org
>> 
>> 
>> Matthias Meulien wrote:
>> > 
>> > kobarity <kobarity@gmail.com> writes:
>> > 
>> > > (...) How about the following descriptions?
>> > >
>> > > python-interpreter
>> > >   Python interpreter for noninteractive use.
>> > > python-interpreter-args
>> > >   Arguments for the Python interpreter for noninteractive use.
>> > > python-shell-interpreter
>> > >   Python interpreter for interactive use.
>> > > python-shell-interpreter-args
>> > >   Arguments for the Python interpreter for interactive use.
>> > 
>> > I like it.  But you skipped python-shell-interpreter-interactive-arg...
>> 
>> Sorry, I forgot about that.
>> `python-shell-interpreter-interactive-arg' is used only for prompt
>> detection, and its docstring has only one line:
>> 
>> Interpreter argument to force it to run interactively.
>> 
>> I think we can leave it as is, but if we want to improve it, how about
>> adding the second line?  I could not shorten it to fit on one line.
>> 
>> Interpreter argument to force it to run interactively.
>> This is used only for prompt detection.
>
> Thanks.
>
> Matthias, can you post an updated patch where the last comments about
> doc strings are taken care of?

Yes, here it is.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Custom-var-python-interpreter-args-bug-64397.patch --]
[-- Type: text/x-diff, Size: 6078 bytes --]

From e93577859330e8d7e42bc7cb7c9229ba6e722666 Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Thu, 13 Jul 2023 23:38:41 +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-shell-interpreter, python-shell-interpreter-args)
(python-shell-interpreter-interactive-arg): Improve documentation.
(python--list-imports, python--do-isort, python-fix-imports): Make
process use customisable arguments.
---
 etc/NEWS                 |  4 +++
 lisp/progmodes/python.el | 59 ++++++++++++++++++++++++++++------------
 2 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 5d5ea990b92..ee099189e3b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -397,6 +397,10 @@ instead of:
         and another_expression):
         do_something()
 
+*** New user option 'python-interpreter-args'.
+This allows the user to specify command line arguments to the non
+interactive Python interpreter specified by 'python-interpreter'.
+
 ** use-package
 
 +++
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 4291ab03ca6..e7044012cde 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.
-To customize the Python shell, modify `python-shell-interpreter'
-instead."
+Some Python interpreters also require changes to
+`python-interpreter-args'.
+
+To customize the Python interpreter for interactive use, modify
+`python-shell-interpreter' instead."
   :version "29.1"
   :type 'string)
 
+(defcustom python-interpreter-args ""
+  "Arguments for the Python interpreter for noninteractive use."
+  :version "30.1"
+  :type 'string)
 
 \f
 ;;; Bindings
@@ -2558,7 +2565,7 @@ python-shell-interpreter
   (cond ((executable-find "python3") "python3")
         ((executable-find "python") "python")
         (t "python3"))
-  "Default Python interpreter for shell.
+  "Python interpreter for interactive use.
 
 Some Python interpreters also require changes to
 `python-shell-interpreter-args'.  In particular, setting
@@ -2573,11 +2580,12 @@ python-shell-internal-buffer-name
   :safe 'stringp)
 
 (defcustom python-shell-interpreter-args "-i"
-  "Default arguments for the Python interpreter."
+  "Arguments for the Python interpreter for interactive use."
   :type 'string)
 
 (defcustom python-shell-interpreter-interactive-arg "-i"
-  "Interpreter argument to force it to run interactively."
+  "Interpreter argument to force it to run interactively.
+This is used only for prompt detection."
   :type 'string
   :version "24.4")
 
@@ -6494,18 +6502,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)
         (cond
          ((eq 1 status)
@@ -6554,7 +6569,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)))
             (cond
              ((eq 1 status)
@@ -6628,10 +6647,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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-13 21:44                 ` Matthias Meulien
@ 2023-07-15  8:30                   ` Eli Zaretskii
  2023-07-17 19:17                     ` Matthias Meulien
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2023-07-15  8:30 UTC (permalink / raw)
  To: Matthias Meulien; +Cc: kobarity, arstoffel, 64397

> From: Matthias Meulien <orontee@gmail.com>
> Cc: kobarity <kobarity@gmail.com>,  arstoffel@gmail.com,  64397@debbugs.gnu.org
> Date: Thu, 13 Jul 2023 23:44:22 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Matthias, can you post an updated patch where the last comments about
> > doc strings are taken care of?
> 
> Yes, here it is.

Thanks.  This is for master, right?  Because it fails to apply, even
without the NEWS entry (which are sometimes problematic).  Could you
please rebase on master and resubmit?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-15  8:30                   ` Eli Zaretskii
@ 2023-07-17 19:17                     ` Matthias Meulien
  2023-07-20 16:02                       ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Matthias Meulien @ 2023-07-17 19:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: kobarity, arstoffel, 64397

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> Thanks.  This is for master, right?  Because it fails to apply, even
> without the NEWS entry (which are sometimes problematic).  Could you
> please rebase on master and resubmit?

Yes, this is for master.  Here is an updated patch generated from commit
bec707da4db.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Custom-var-python-interpreter-args-bug-64397.patch --]
[-- Type: text/x-diff, Size: 6185 bytes --]

From 11a08b43ab581fe0b4c91a82a6344486793c7bbf Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Thu, 13 Jul 2023 23:38:41 +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-shell-interpreter, python-shell-interpreter-args)
(python-shell-interpreter-interactive-arg): Improve documentation.
(python--list-imports, python--do-isort, python-fix-imports): Make
process use customisable arguments.
---
 etc/NEWS                 |  4 +++
 lisp/progmodes/python.el | 59 ++++++++++++++++++++++++++++------------
 2 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 3cfc36e10da..bc596f5c03e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -411,6 +411,10 @@ instead of:
         and another_expression):
         do_something()
 
+*** New user option 'python-interpreter-args'.
+This allows the user to specify command line arguments to the non
+interactive Python interpreter specified by 'python-interpreter'.
+
 ** use-package
 
 +++
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index a23339a2180..52e5a36f4b0 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.
-To customize the Python shell, modify `python-shell-interpreter'
-instead."
+Some Python interpreters also require changes to
+`python-interpreter-args'.
+
+To customize the Python interpreter for interactive use, modify
+`python-shell-interpreter' instead."
   :version "29.1"
   :type 'string)
 
+(defcustom python-interpreter-args ""
+  "Arguments for the Python interpreter for noninteractive use."
+  :version "30.1"
+  :type 'string)
 
 \f
 ;;; Bindings
@@ -2558,7 +2565,7 @@ python-shell-interpreter
   (cond ((executable-find "python3") "python3")
         ((executable-find "python") "python")
         (t "python3"))
-  "Default Python interpreter for shell.
+  "Python interpreter for interactive use.
 
 Some Python interpreters also require changes to
 `python-shell-interpreter-args'.  In particular, setting
@@ -2573,11 +2580,12 @@ python-shell-internal-buffer-name
   :safe 'stringp)
 
 (defcustom python-shell-interpreter-args "-i"
-  "Default arguments for the Python interpreter."
+  "Arguments for the Python interpreter for interactive use."
   :type 'string)
 
 (defcustom python-shell-interpreter-interactive-arg "-i"
-  "Interpreter argument to force it to run interactively."
+  "Interpreter argument to force it to run interactively.
+This is used only for prompt detection."
   :type 'string
   :version "24.4")
 
@@ -6505,18 +6513,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)
         (python--list-imports-check-status status)
         (goto-char (point-min))
@@ -6559,7 +6574,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?)"
@@ -6629,10 +6648,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


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
Matthias

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter
  2023-07-17 19:17                     ` Matthias Meulien
@ 2023-07-20 16:02                       ` Eli Zaretskii
  0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2023-07-20 16:02 UTC (permalink / raw)
  To: Matthias Meulien; +Cc: kobarity, arstoffel, 64397-done

> From: Matthias Meulien <orontee@gmail.com>
> Cc: kobarity@gmail.com,  arstoffel@gmail.com,  64397@debbugs.gnu.org
> Date: Mon, 17 Jul 2023 21:17:19 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Thanks.  This is for master, right?  Because it fails to apply, even
> > without the NEWS entry (which are sometimes problematic).  Could you
> > please rebase on master and resubmit?
> 
> Yes, this is for master.  Here is an updated patch generated from commit
> bec707da4db.

Thanks, installed on master, and closing the bug.





^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-07-20 16:02 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-01  6:33 bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter Matthias Meulien
2023-07-01 16:10 ` Matthias Meulien
2023-07-06  7:21   ` Eli Zaretskii
2023-07-06 14:51     ` kobarity
2023-07-07  8:09       ` Augusto Stoffel
2023-07-06 20:39     ` Matthias Meulien
2023-07-08  7:52       ` Eli Zaretskii
2023-07-08 11:28         ` kobarity
2023-07-08 13:50           ` Eli Zaretskii
2023-07-08 16:28           ` Matthias Meulien
2023-07-09 12:17             ` kobarity
2023-07-13  5:50               ` Eli Zaretskii
2023-07-13 21:44                 ` Matthias Meulien
2023-07-15  8:30                   ` Eli Zaretskii
2023-07-17 19:17                     ` Matthias Meulien
2023-07-20 16:02                       ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.