From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matthias Meulien Newsgroups: gmane.emacs.bugs Subject: bug#64397: 29.0.91; Limited configuration of commands based on python-interpreter Date: Sat, 01 Jul 2023 18:10:21 +0200 Message-ID: <87edlrbok2.fsf@gmail.com> References: <87leg0b0oy.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1987"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 64397@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 01 18:11:27 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFdC2-0000OV-VY for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Jul 2023 18:11:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFdBh-0004uy-AK; Sat, 01 Jul 2023 12:11:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFdBe-0004tk-7z for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2023 12:11:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFdBd-0007Ln-Vc for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2023 12:11:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qFdBd-0006Ni-Qs for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2023 12:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Matthias Meulien Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Jul 2023 16:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64397 X-GNU-PR-Package: emacs Original-Received: via spool by 64397-submit@debbugs.gnu.org id=B64397.168822784224501 (code B ref 64397); Sat, 01 Jul 2023 16:11:01 +0000 Original-Received: (at 64397) by debbugs.gnu.org; 1 Jul 2023 16:10:42 +0000 Original-Received: from localhost ([127.0.0.1]:58545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qFdBJ-0006N6-J9 for submit@debbugs.gnu.org; Sat, 01 Jul 2023 12:10:42 -0400 Original-Received: from mail-wm1-f50.google.com ([209.85.128.50]:45330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qFdBG-0006Mr-SS for 64397@debbugs.gnu.org; Sat, 01 Jul 2023 12:10:40 -0400 Original-Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-3fbc59de0e2so23632045e9.3 for <64397@debbugs.gnu.org>; Sat, 01 Jul 2023 09:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688227833; x=1690819833; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=C4XL+eWJvHqT6GqZAdhrFJnEpK6RzxtUinp9vVBnKUk=; b=C+/gU7aSUigBw+fS6QzGeSksO8ZweG9BcbDZ8/5wb6STCaQrrvlBVhKLwlJ5aACXci HU8NojK7MvjqQW6/e+D4k9Tq3GcDwwAPIokqf+pmNYQQHrBwoqfB54KBvAhuePnGRbre pIl51lF/0BUqBfoFmwKLvxxNY/FbOfkgQGHTbhC08YGms9k9D3YHr8umndwgtHmyBGlv O2q0Q0ZFAf+PwU51GYz/ZXc6/F7yX752ZnwMoJUkIbUqlEQuacu2dywmzvK9KbYYqrTW 60OBV5DMTxF4oqGrDJNr4gj6KBdEpTyPUgVJffThBrvVhu13wtBE17ZQndIbggmcmSn7 pw0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688227833; x=1690819833; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=C4XL+eWJvHqT6GqZAdhrFJnEpK6RzxtUinp9vVBnKUk=; b=XjtXVWPjGsm9uBOIOsT+y6HY2Mtn6nOxUsyiEg1ZR4+feBAF0YnIWO5AYLVVSzXn9m istdkOTIQBX1cUAGNroLYZ9JrLRAOoCUP1LNoe5ZEAK9BBuazglAAIMjReeKT/x+skOq BtoYx2F/L/KkORcij6KHdHojzPOyrPYi5fkCRgfWcpWqQjAZVp5ATHlFpi3eWfpkQWf0 /EWWJcuWZQlqRDAM/uD5LwCDwBWbH/HHeR8uODe5hUlt832HCegEq+2lDv6DZsOmuHqW nVaJmTPaTT9oD/6udmqzfIDqKOcTr+hG6XC9jYeZ+HznJvRUgWXJT5HOlc+wKePAVx3U zrag== X-Gm-Message-State: AC+VfDxOO4Td45D+T0ZzwH8zQei8Fzur8KhFqWEpwtlBJ7tlj/gvPaEa hafFWCdNxcDK5tLgqVShsXzyoEqZfl11rQ== X-Google-Smtp-Source: ACHHUZ6btCOGFmepkO/4cH36ikVAlnQGN5xp/UhKuP7BefPdZkbdelUOHMy/kfwvjBTUNKpWYgwfbw== X-Received: by 2002:a05:600c:3787:b0:3fa:8c67:fc43 with SMTP id o7-20020a05600c378700b003fa8c67fc43mr4511148wmr.32.1688227832898; Sat, 01 Jul 2023 09:10:32 -0700 (PDT) Original-Received: from carbon.localdomain ([2a01:e0a:245:c850:98f5:429a:aa8e:95bb]) by smtp.gmail.com with ESMTPSA id v11-20020adff68b000000b0031424950a99sm4016670wrp.81.2023.07.01.09.10.32 for <64397@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jul 2023 09:10:32 -0700 (PDT) In-Reply-To: <87leg0b0oy.fsf@gmail.com> (Matthias Meulien's message of "Sat, 01 Jul 2023 08:33:33 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264412 Archived-At: --=-=-= Content-Type: text/plain Here's a patch adding a python-interpreter-args custom variable. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Custom-var-python-interpreter-args-bug-64397.patch >From 729e8892c129c2f3c6dfd0f119259d586fe11118 Mon Sep 17 00:00:00 2001 From: Matthias Meulien 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 --=-=-= Content-Type: text/plain -- Matthias --=-=-=--