From unknown Sat Jun 14 19:43:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#57184: [PATCH] Assorted improvements to python.el Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Aug 2022 17:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57184 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 57184@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166041038325407 (code B ref -1); Sat, 13 Aug 2022 17:07:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Aug 2022 17:06:23 +0000 Received: from localhost ([127.0.0.1]:34994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMuac-0006bi-82 for submit@debbugs.gnu.org; Sat, 13 Aug 2022 13:06:22 -0400 Received: from lists.gnu.org ([209.51.188.17]:43842) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMuaa-0006ba-D1 for submit@debbugs.gnu.org; Sat, 13 Aug 2022 13:06:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMuaa-0000Ll-96 for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 13:06:20 -0400 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]:41715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMuaY-0002RT-6w for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 13:06:20 -0400 Received: by mail-ej1-x634.google.com with SMTP id gk3so6823552ejb.8 for ; Sat, 13 Aug 2022 10:06:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc; bh=LI0GfXTlCW1kJuyiZUccRcBdE5k84g/x3lv+3shPN8M=; b=lnPPTjtmqAgf1H+E51DPxD//rjLC1tvM5GrcdHEOQs49eM2uZD8KF9+GhCpuhOB8lG /oX0M4qUWgMXwmhAtTTbrBJnFAIhIOL0VQiLpkqoc5fwZy2nWBLPgHA7s5jx9y9dbAw3 VG+MMXUuCfocpNIuxj76q+ojrFh3tTE0N4nVZfBsRiy91zMPIjvDwhrZ7awuds0HUrAm nQmU1MWmav9FV/6yB0qXObxnNofDdSi7GK9TTICCNTD6Xd+geiHNj6ata1LoS/ATwzGB 68aDd4indFP7Sw0pU/ciPMdQcVwG/ajeSMSkzNRxwliiUr9fIFsm7f/BHWS5/MaqGeGc Bnvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc; bh=LI0GfXTlCW1kJuyiZUccRcBdE5k84g/x3lv+3shPN8M=; b=IsLIrEYcIVYsDyf+0uTSqgWzkflk3lQVmF2dA7jCrhnP4VZ0zKgwkPM+vtTJVil17t WN3VdC/ndp7l6DcLUB/m2SHGrzOq6KjtmbwZfJrbFA20XQaBh1AUib1a+XBu5EzMJE9x 0Fn/gcT43PZCJH7DVCjNCazJM/P1c8Kt1CjqlvSg7wSlXClk8AXQfTNcyIUjBtBnGPB8 mdqxaODn/UdsJ08yKNPmjkl3wBsvNDIDiND+55ed1xcE03Pwfp+43+W5fzG9zvcMlaO0 vDoxUaOcYbAoQazyuIIkJkQrp9F8zQ+nJu0yzGKuItrJX0SEEgdqV6cKx8vh+hK0Vfvj fZJA== X-Gm-Message-State: ACgBeo37QhGuji0ZJMrdGUkVnh/ppuPQMeHwnUl4luHyvFZwDf9AIyid PL4f12ANUbRbPxiHXL0fvzHZMeeBvHM= X-Google-Smtp-Source: AA6agR7lhgONMRumKuIbP9CBwzkDcVtU1z8SVvWu5PKkgi2YRm9md6k5iEvOAiXeP9wNZI6IRU0EEQ== X-Received: by 2002:a17:907:60c6:b0:730:d10f:4 with SMTP id hv6-20020a17090760c600b00730d10f0004mr5794271ejc.217.1660410372748; Sat, 13 Aug 2022 10:06:12 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::2fb8]) by smtp.gmail.com with ESMTPSA id bt2-20020a0564020a4200b0043d1eff72b3sm3306140edb.74.2022.08.13.10.06.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 10:06:11 -0700 (PDT) From: Augusto Stoffel Date: Sat, 13 Aug 2022 19:06:10 +0200 Message-ID: <875yiw9ipp.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=arstoffel@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain I have attached a sequence of patches with assorted small(ish) improvements to python.el. I hope this is a suitable format for review; let me know otherwise. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-python-check-command-don-t-use-absolute-executable-n.patch >From c68623c2da14ae436276c84ae3705f1708e2bd92 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sat, 13 Aug 2022 17:04:17 +0200 Subject: [PATCH 1/4] python-check-command: don't use absolute executable names This is incompatible with Tramp and packages that switch between virtualenvs. * lisp/progmodes/python.el (python-check-command): don't use absolute executable names. --- lisp/progmodes/python.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 96f9d14832..3176d12bd1 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4702,9 +4702,9 @@ ffap-alist ;;; Code check (defcustom python-check-command - (or (executable-find "pyflakes") - (executable-find "epylint") - "install pyflakes, pylint or something else") + (cond ((executable-find "pyflakes") "pyflakes") + ((executable-find "epylint") "epylint") + (t "pyflakes")) "Command used to check a Python file." :type 'string) -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-python.el-Adjustments-to-Flymake-backend.patch >From d0f754b3d39a8189ba6cc2d09aea0973f79f4ca6 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sat, 13 Aug 2022 17:39:57 +0200 Subject: [PATCH 2/4] python.el: Adjustments to Flymake backend * lisp/progmodes/python (python-flymake-command): Advertise possiblity to use pylint. (python-flymake-command-output-pattern): Make compatible with pyflakes version 2.4.0 --- lisp/progmodes/python.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3176d12bd1..be1d3aab00 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5625,9 +5625,13 @@ python-flymake-command This is a non empty list of strings, the checker tool possibly followed by required arguments. Once launched it will receive the Python source to be checked as its standard input. -To use `flake8' you would set this to (\"flake8\" \"-\")." +To use `flake8' you would set this to (\"flake8\" \"-\"). +To use `pylint' you would set this to (\"pylint\" \"--from-stdin\" \"stdin\")." :version "26.1" - :type '(repeat string)) + :type '(choice (const :tag "Pyflakes" ("pyflakes")) + (const :tag "Flake8" ("flake8" "-")) + (const :tag "Pylint" ("pylint" "--from-stdin" "stdin")) + (repeat :tag "Custom command" string))) ;; The default regexp accommodates for older pyflakes, which did not ;; report the column number, and at the same time it's compatible with @@ -5635,7 +5639,7 @@ python-flymake-command ;; TYPE (defcustom python-flymake-command-output-pattern (list - "^\\(?:?\\):\\(?1:[0-9]+\\):\\(?:\\(?2:[0-9]+\\):\\)? \\(?3:.*\\)$" + "^\\(?:?\\):\\(?1:[0-9]+\\):\\(?:\\(?2:[0-9]+\\):?\\)? \\(?3:.*\\)$" 1 2 nil 3) "Specify how to parse the output of `python-flymake-command'. The value has the form (REGEXP LINE COLUMN TYPE MESSAGE): if -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-python.el-Add-completion-predicate-symbol-property-t.patch >From 95675a3f63bc420813992d7b599e99b303e4fd63 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sat, 13 Aug 2022 18:10:14 +0200 Subject: [PATCH 3/4] python.el: Add completion-predicate symbol property to commands * lisp/progmodes/python.el: Add a completion-predicate property to most commands defined in this file; some are only useful in python-mode, others in inferior-python mode as well. (python-skeleton-define, python-define-auxiliary-skeleton): Add appropriate completion-predicate properties. --- lisp/progmodes/python.el | 75 +++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 8 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index be1d3aab00..163bae07c2 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4546,8 +4546,13 @@ python-skeleton-define be added to `python-mode-skeleton-abbrev-table'." (declare (indent 2)) (let* ((name (symbol-name name)) - (function-name (intern (concat "python-skeleton-" name)))) + (function-name (intern (concat "python-skeleton-" name))) + (completion-predicate (lambda (_ buffer) + (provided-mode-derived-p + (buffer-local-value 'major-mode buffer) + 'python-mode)))) `(progn + (put ',function-name 'completion-predicate ,completion-predicate) (define-abbrev python-mode-skeleton-abbrev-table ,name "" ',function-name :system t) (setq python-skeleton-available @@ -4573,13 +4578,15 @@ python-define-auxiliary-skeleton (setq skel `(< ,(format "%s:" name) \n \n > _ \n))) - `(define-skeleton ,function-name - ,(or doc - (format "Auxiliary skeleton for %s statement." name)) - nil - (unless (y-or-n-p ,msg) - (signal 'quit t)) - ,@skel))) + `(progn + (put ',function-name 'completion-predicate #'ignore) + (define-skeleton ,function-name + ,(or doc + (format "Auxiliary skeleton for %s statement." name)) + nil + (unless (y-or-n-p ,msg) + (signal 'quit t)) + ,@skel)))) (python-define-auxiliary-skeleton else) @@ -5864,6 +5871,58 @@ python-mode (add-hook 'flymake-diagnostic-functions #'python-flymake nil t)) +;;; Completion predicates for M-x +(dolist (sym '(python-check + python-fill-paragraph + python-indent-dedent-line + python-indent-dedent-line-backspace + python-indent-guess-indent-offset + python-indent-shift-left + python-indent-shift-right + python-mark-defun + python-nav-backward-block + python-nav-backward-defun + python-nav-backward-sexp + python-nav-backward-sexp-safe + python-nav-backward-statement + python-nav-backward-up-list + python-nav-beginning-of-block + python-nav-beginning-of-statement + python-nav-end-of-block + python-nav-end-of-defun + python-nav-end-of-statement + python-nav-forward-block + python-nav-forward-defun + python-nav-forward-sexp + python-nav-forward-sexp-safe + python-nav-forward-statement + python-nav-if-name-main + python-nav-up-list + python-shell-send-buffer + python-shell-send-defun + python-shell-send-statement)) + (put sym 'completion-predicate (lambda (_ buffer) + (provided-mode-derived-p + (buffer-local-value 'major-mode buffer) + 'python-mode)))) + +(dolist (sym '(python-describe-at-point + python-eldoc-at-point + python-shell-completion-native-toggle + python-shell-completion-native-turn-off + python-shell-completion-native-turn-on + python-shell-completion-native-turn-on-maybe + python-shell-font-lock-cleanup-buffer + python-shell-font-lock-toggle + python-shell-font-lock-turn-off + python-shell-font-lock-turn-on + python-shell-package-enable + python-shell-completion-complete-or-indent )) + (put sym 'completion-predicate (lambda (_ buffer) + (provided-mode-derived-p + (buffer-local-value 'major-mode buffer) + 'python-mode 'inferior-python-mode)))) + (provide 'python) ;;; python.el ends here -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0004-python-mode-Remove-special-outline-heading-end-regex.patch >From 97895f6c5afcd2c0236185ff406c3d4261fbc567 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sat, 13 Aug 2022 18:55:48 +0200 Subject: [PATCH 4/4] python-mode: Remove special outline-heading-end-regexp It doesn't work well with the new type annotation syntax introduced in Python 3.5, see bug#53913. * lisp/progmodes/python.el (python-mode): remove buffer-local setting of outline-heading-end-regexp. --- lisp/progmodes/python.el | 1 - 1 file changed, 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 163bae07c2..8cd654ce14 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5854,7 +5854,6 @@ python-mode nil)) (setq-local outline-regexp (python-rx (* space) block-start)) - (setq-local outline-heading-end-regexp ":[^\n]*\n") (setq-local outline-level (lambda () "`outline-level' function for Python mode." -- 2.37.1 --=-=-=-- From unknown Sat Jun 14 19:43:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#57184: [PATCH] Assorted improvements to python.el Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Aug 2022 18:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57184 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Augusto Stoffel , 57184@debbugs.gnu.org Received: via spool by 57184-submit@debbugs.gnu.org id=B57184.1660415191476 (code B ref 57184); Sat, 13 Aug 2022 18:27:01 +0000 Received: (at 57184) by debbugs.gnu.org; 13 Aug 2022 18:26:31 +0000 Received: from localhost ([127.0.0.1]:35079 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMvqB-00007c-Ap for submit@debbugs.gnu.org; Sat, 13 Aug 2022 14:26:31 -0400 Received: from mail-vs1-f47.google.com ([209.85.217.47]:36718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMvq7-00007M-1l for 57184@debbugs.gnu.org; Sat, 13 Aug 2022 14:26:29 -0400 Received: by mail-vs1-f47.google.com with SMTP id o123so3735787vsc.3 for <57184@debbugs.gnu.org>; Sat, 13 Aug 2022 11:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :from:to:cc; bh=53ynB3FrIFLktgR5+F+FB6tvvYF6nS7B9skFAIwU/tc=; b=gt8J6kg/xYiwOoGbDrrsCNYV34NoaZj1FUoYDXYPQpzNSXuUSb/e0ZLIqar/3uRlaD Vl7nc/WFM/sklXR9ZHuL2hs5CBgG6U+R/S3rgiB0dbz3pghbTT++PPNMzrBZ0NgvcqG1 OMPN93yCGeY+sycxDt6PGy3EKVuv5mKToitDG1mDOnYZhLcAH5ZUDQEodMP8D3uajlD3 qIs4IRmOAvV+Gcswpw8IqENmgQ680JhAvz4gtuWPVjPDclTIkf+TBtzvcfpMyUlEvdxJ wnUv7+SKh5b2GPsrDeVucmoLggW3m0g7Ju3NyogC6LXPPKO98jyRzaL3t0fxYNcyNNeS o78A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :x-gm-message-state:from:to:cc; bh=53ynB3FrIFLktgR5+F+FB6tvvYF6nS7B9skFAIwU/tc=; b=FbJaYBPy8qg4LZEilITYuFtxfwLDcABqvDgGIDOFmNR+VyL5ZjvJXNtWeoF43Mkaeo 2keTl4QYhACxQsawFLUk4ERnxkXDTsqL0lDQ7Ubi7bYMwYjpChdh9jmfRj/8w2cTZEF0 z/ZtBhQdA9g1JGngLizI0WAg0Ja4m8kyoUxq6DpkOsblUmkQEcKGRnd6xiT4ZQEYsp8o QvYae9k+lj9DxENqJnVrKq09Sg878uRABGLXRC4nauT4QSTBm0Yf1Na1UBW2MwukhwdK DgwwI3NmipbH7mJLF0sBavE2tkOSWPNev4QsOhiVCAKchmfI4/WGh4RZlH/8f6r3zX0R 8OcA== X-Gm-Message-State: ACgBeo1sBvC2/rboydBCV19BZ5OP0XRyshjVLwY/E5ujJhhtm6xC6QKk 1ImaAu3xWIzJk3X9ao+Hc/QOx+oD7/MDWbQUIMw= X-Google-Smtp-Source: AA6agR7a1sQJpVqBBTAomoArhRDDfQwsCBHu2z8ErhwfkJwNEVAp6zGIsTkRPIrkbitXN+Bx4sKUaewr/ys9PRBRRqM= X-Received: by 2002:a67:ff85:0:b0:387:473f:9056 with SMTP id v5-20020a67ff85000000b00387473f9056mr3771779vsq.85.1660415181018; Sat, 13 Aug 2022 11:26:21 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 13 Aug 2022 11:26:20 -0700 From: Stefan Kangas In-Reply-To: <875yiw9ipp.fsf@gmail.com> References: <875yiw9ipp.fsf@gmail.com> X-Hashcash: 1:20:220813:57184@debbugs.gnu.org::oWSh4NsQKCmQFe5j:0cd6 MIME-Version: 1.0 Date: Sat, 13 Aug 2022 11:26:20 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Augusto Stoffel writes: > I hope this is a suitable format for review; let me know otherwise. It's perfect, thanks for the patches. Please find some comments below. > From c68623c2da14ae436276c84ae3705f1708e2bd92 Mon Sep 17 00:00:00 2001 > From: Augusto Stoffel > Date: Sat, 13 Aug 2022 17:04:17 +0200 > Subject: [PATCH 1/4] python-check-command: don't use absolute executable names Better: python-check-command: Don't use absolute file names > This is incompatible with Tramp and packages that switch between > virtualenvs. More clear: Absolute file names are incompatible with Tramp and packages that switch between virtualenvs. > * lisp/progmodes/python.el (python-check-command): don't use absolute > executable names. As above, note that we prefer to capitalize "Don't". > Subject: [PATCH 2/4] python.el: Adjustments to Flymake back-end How about: python.el: Support pyflakes 2.4+ in flymake > * lisp/progmodes/python (python-flymake-command): Advertise possiblity > to use pylint. > (python-flymake-command-output-pattern): Make compatible with pyflakes > version 2.4.0 ^^^ Missing period > @@ -5635,7 +5639,7 @@ python-flymake-command > ;; TYPE > (defcustom python-flymake-command-output-pattern > (list > - "^\\(?:?\\):\\(?1:[0-9]+\\):\\(?:\\(?2:[0-9]+\\):\\)? \\(?3:.*\\)$" > + "^\\(?:?\\):\\(?1:[0-9]+\\):\\(?:\\(?2:[0-9]+\\):?\\)? \\(?3:.*\\)$" Maybe include an example of the old/new pattern in comments? Or even better actually: add a test for it. > From 95675a3f63bc420813992d7b599e99b303e4fd63 Mon Sep 17 00:00:00 2001 > From: Augusto Stoffel > Date: Sat, 13 Aug 2022 18:10:14 +0200 > Subject: [PATCH 3/4] python.el: Add completion-predicate symbol property to > commands > > * lisp/progmodes/python.el: Add a completion-predicate property to > most commands defined in this file; some are only useful in > python-mode, others in inferior-python mode as well. > (python-skeleton-define, python-define-auxiliary-skeleton): Add > appropriate completion-predicate properties. This makes sense, but how about just creating a new mode python-common-mode that both python-mode and inferior-python-mode could inherit from? Would that simplify things here? > From 97895f6c5afcd2c0236185ff406c3d4261fbc567 Mon Sep 17 00:00:00 2001 > From: Augusto Stoffel > Date: Sat, 13 Aug 2022 18:55:48 +0200 > Subject: [PATCH 4/4] python-mode: Remove special outline-heading-end-regexp > > It doesn't work well with the new type annotation syntax introduced in > Python 3.5, see bug#53913. > > * lisp/progmodes/python.el (python-mode): remove buffer-local setting ^^^ Capitalize "Remove" > of outline-heading-end-regexp. > --- > lisp/progmodes/python.el | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el > index 163bae07c2..8cd654ce14 100644 > --- a/lisp/progmodes/python.el > +++ b/lisp/progmodes/python.el > @@ -5854,7 +5854,6 @@ python-mode > nil)) > > (setq-local outline-regexp (python-rx (* space) block-start)) > - (setq-local outline-heading-end-regexp ":[^\n]*\n") > (setq-local outline-level > (lambda () > "`outline-level' function for Python mode." I'm fine with this as `outline-heading-end-regexp' doesn't seem to see much use in any case (and folding to one line somehow seems nicer anyways). However, it seems like we might be able to do find a fix here with just a small number of assumptions, if we really wanted to. From unknown Sat Jun 14 19:43:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#57184: [PATCH] Assorted improvements to python.el Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Aug 2022 08:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57184 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: 57184@debbugs.gnu.org Received: via spool by 57184-submit@debbugs.gnu.org id=B57184.166046654810993 (code B ref 57184); Sun, 14 Aug 2022 08:43:02 +0000 Received: (at 57184) by debbugs.gnu.org; 14 Aug 2022 08:42:28 +0000 Received: from localhost ([127.0.0.1]:35761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oN9CV-0002rE-6d for submit@debbugs.gnu.org; Sun, 14 Aug 2022 04:42:28 -0400 Received: from mail-ed1-f46.google.com ([209.85.208.46]:41602) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oN9CQ-0002qz-Po for 57184@debbugs.gnu.org; Sun, 14 Aug 2022 04:42:25 -0400 Received: by mail-ed1-f46.google.com with SMTP id r4so6178663edi.8 for <57184@debbugs.gnu.org>; Sun, 14 Aug 2022 01:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc; bh=AHFvbGw4sVHvJCI8qE2i0eWVYgS+uAN1N9i/Wz6D08o=; b=UqKKkCn0NrItIfyV81/dbtcZ1G5oJvnpNwzPeKCtfk0oTxrLxqa7Sn7Wp8qtA5w7Yt BTv9PWc8wO+teWKfY6P58duj+sWy9YXSGOYkse82Rv2iatvYRB1CoeykzW5cX0e9pfhh eehfsudbS7zJex8SAtVQUDXMZIidgOxLBO9DrWwSjNnv/Hy3VmkQQ9ZSV7pdB70RfTyK qhjunweI0LkOysaUang3swg2ZhRapRYk+Ojr5g4H2U9ZwsYsXkk0JnRnj4zEykkWxo9O Mv9tLdiJSbWOdde47aFKw4f96F9r8Mk2z772pEqnYnNR7HBon+oUrtyMN4tvNKZQ1Gye FIgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc; bh=AHFvbGw4sVHvJCI8qE2i0eWVYgS+uAN1N9i/Wz6D08o=; b=voJHpGxAe3bHNpxtrJNYuT48e4TeceXNy/ifSj54zAWuJlDoIr31Mnot412QJoBjDB BMWFuRw3pvbYy58nF22tpgx8/PfAORDDOpcoyJgefspctDrRaSlDnit3AlPHJXlgHLwM RHpIryDHaBl9OLPM1cckYXVd5sENBO7tlR9G8ZTcTIkwlSoM+c/a1dKak0qNETLit6vs vzyIHcWq/Xx4OWpKJ5Ipkx4ov0a3ydpKMafzwhUB/indA8cEx5IPM7e5ILJTeV3XXKJ7 mzvFqe9bgbFi9o+vyfjPLGUbuEZaVuJf9Of8JtO/dLWJ4LvmDE67T+vE9xV7wcM+xaIB FU1g== X-Gm-Message-State: ACgBeo0F7CkGuB3UBZ2WwBGPQYMGbytnkCLtQDn6NAbpF5Ygl0DUGG8T aHh3LBXjwXNg2jL3dp9FfKdQugzebEQ= X-Google-Smtp-Source: AA6agR6sGaJmSYG1BTaue7whneGvSCpjtiUg79tqb0XzCzHuUpuZ+iv+jg85Dk8cCPM3pA5I2F2+YA== X-Received: by 2002:a05:6402:3210:b0:43d:20bc:5e4 with SMTP id g16-20020a056402321000b0043d20bc05e4mr9966236eda.276.1660466535475; Sun, 14 Aug 2022 01:42:15 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::2fb8]) by smtp.gmail.com with ESMTPSA id b20-20020a170906195400b0072b7d76211dsm2677857eje.107.2022.08.14.01.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Aug 2022 01:42:14 -0700 (PDT) From: Augusto Stoffel In-Reply-To: (Stefan Kangas's message of "Sat, 13 Aug 2022 11:26:20 -0700") References: <875yiw9ipp.fsf@gmail.com> Date: Sun, 14 Aug 2022 10:42:11 +0200 Message-ID: <87zgg75i8s.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hi Stefan, I've attached new patches, see below for comments on your comments. (As to the smaller style changes, feel free to copyedit my patches before merging in case I still let something slip.) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-python-check-command-Don-t-use-absolute-file-names.patch >From 34a28cf6cfca66751de2e0f8269e685e9638d8ea Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sat, 13 Aug 2022 17:04:17 +0200 Subject: [PATCH 1/4] python-check-command: Don't use absolute file names Absolute executable file names are incompatible with Tramp and packages that switch between virtualenvs. * lisp/progmodes/python.el (python-check-command): Don't use absolute file names. --- lisp/progmodes/python.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 96f9d14832..3176d12bd1 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4702,9 +4702,9 @@ ffap-alist ;;; Code check (defcustom python-check-command - (or (executable-find "pyflakes") - (executable-find "epylint") - "install pyflakes, pylint or something else") + (cond ((executable-find "pyflakes") "pyflakes") + ((executable-find "epylint") "epylint") + (t "pyflakes")) "Command used to check a Python file." :type 'string) -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-python.el-Adjustments-to-Flymake-backend.patch >From 86ed1979e39a6ee211259912b764b8b755ee129e Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sat, 13 Aug 2022 17:39:57 +0200 Subject: [PATCH 2/4] python.el: Adjustments to Flymake backend * lisp/progmodes/python (python-flymake-command): Advertise possiblity to use pylint. (python-flymake-command-output-pattern): Make compatible with recent versions of pyflakes. --- lisp/progmodes/python.el | 12 ++++++---- test/lisp/progmodes/python-tests.el | 34 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3176d12bd1..f473fc0369 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5625,9 +5625,13 @@ python-flymake-command This is a non empty list of strings, the checker tool possibly followed by required arguments. Once launched it will receive the Python source to be checked as its standard input. -To use `flake8' you would set this to (\"flake8\" \"-\")." +To use `flake8' you would set this to (\"flake8\" \"-\"). +To use `pylint' you would set this to (\"pylint\" \"--from-stdin\" \"stdin\")." :version "26.1" - :type '(repeat string)) + :type '(choice (const :tag "Pyflakes" ("pyflakes")) + (const :tag "Flake8" ("flake8" "-")) + (const :tag "Pylint" ("pylint" "--from-stdin" "stdin")) + (repeat :tag "Custom command" string))) ;; The default regexp accommodates for older pyflakes, which did not ;; report the column number, and at the same time it's compatible with @@ -5635,7 +5639,7 @@ python-flymake-command ;; TYPE (defcustom python-flymake-command-output-pattern (list - "^\\(?:?\\):\\(?1:[0-9]+\\):\\(?:\\(?2:[0-9]+\\):\\)? \\(?3:.*\\)$" + "^\\(?:?\\):\\(?1:[0-9]+\\):\\(?:\\(?2:[0-9]+\\):?\\)? \\(?3:.*\\)$" 1 2 nil 3) "Specify how to parse the output of `python-flymake-command'. The value has the form (REGEXP LINE COLUMN TYPE MESSAGE): if @@ -5647,7 +5651,7 @@ python-flymake-command-output-pattern If COLUMN or TYPE are nil or that index didn't match, that information is not present on the matched line and a default will be used." - :version "26.1" + :version "29.1" :type '(list regexp (integer :tag "Line's index") (choice diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index d303050fad..0bfdf1e76b 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -6152,6 +6152,40 @@ python-tests--fill-long-first-line a = 1 "))) + +;;; Flymake + +(ert-deftest python-tests--flymake-command-output-pattern () + (pcase-let ((`(,patt ,line ,col ,type ,msg) + python-flymake-command-output-pattern)) + ;; Pyflakes output as of version 2.4.0 + (let ((output ":12:34 'a.b.c as d' imported but unused")) + (string-match patt output) + (should (equal (match-string line output) "12")) + (when col (should (equal (match-string col output) "34"))) + (should (equal (match-string msg output) + "'a.b.c as d' imported but unused"))) + ;; Flake8 output as of version 4.0.1 + (let ((output "stdin:12:34: F401 'a.b.c as d' imported but unused")) + (string-match patt output) + (should (equal (match-string line output) "12")) + (when col (should (equal (match-string col output) "34"))) + (when type (should (equal (match-string type output) "F401"))) + (should (equal (match-string msg output) + (if type + "'a.b.c as d' imported but unused" + "F401 'a.b.c as d' imported but unused")))) + ;; Pylint output as of version 2.14.5 + (let ((output "stdin:12:34: W0611: Unused import a.b.c (unused-import)")) + (string-match patt output) + (should (equal (match-string line output) "12")) + (when col (should (equal (match-string col output) "34"))) + (when type (should (equal (match-string type output) "W0611"))) + (should (equal (match-string msg output) + (if type + "Unused import a.b.c (unused-import)" + "W0611: Unused import a.b.c (unused-import)")))))) + (provide 'python-tests) ;;; python-tests.el ends here -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-python.el-Add-completion-predicate-symbol-property-t.patch >From b50964dd81be4e45c999fcfc617c1d4603c34668 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sat, 13 Aug 2022 18:10:14 +0200 Subject: [PATCH 3/4] python.el: Add completion-predicate symbol property to commands * lisp/progmodes/python.el: Add a completion-predicate property to most commands defined in this file; some are only useful in python-mode, others in inferior-python mode as well. (python-skeleton-define, python-define-auxiliary-skeleton): Add appropriate completion-predicate properties. --- lisp/progmodes/python.el | 75 +++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 8 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index f473fc0369..a373390d94 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4546,8 +4546,13 @@ python-skeleton-define be added to `python-mode-skeleton-abbrev-table'." (declare (indent 2)) (let* ((name (symbol-name name)) - (function-name (intern (concat "python-skeleton-" name)))) + (function-name (intern (concat "python-skeleton-" name))) + (completion-predicate (lambda (_ buffer) + (provided-mode-derived-p + (buffer-local-value 'major-mode buffer) + 'python-mode)))) `(progn + (put ',function-name 'completion-predicate ,completion-predicate) (define-abbrev python-mode-skeleton-abbrev-table ,name "" ',function-name :system t) (setq python-skeleton-available @@ -4573,13 +4578,15 @@ python-define-auxiliary-skeleton (setq skel `(< ,(format "%s:" name) \n \n > _ \n))) - `(define-skeleton ,function-name - ,(or doc - (format "Auxiliary skeleton for %s statement." name)) - nil - (unless (y-or-n-p ,msg) - (signal 'quit t)) - ,@skel))) + `(progn + (put ',function-name 'completion-predicate #'ignore) + (define-skeleton ,function-name + ,(or doc + (format "Auxiliary skeleton for %s statement." name)) + nil + (unless (y-or-n-p ,msg) + (signal 'quit t)) + ,@skel)))) (python-define-auxiliary-skeleton else) @@ -5864,6 +5871,58 @@ python-mode (add-hook 'flymake-diagnostic-functions #'python-flymake nil t)) +;;; Completion predicates for M-x +(dolist (sym '(python-check + python-fill-paragraph + python-indent-dedent-line + python-indent-dedent-line-backspace + python-indent-guess-indent-offset + python-indent-shift-left + python-indent-shift-right + python-mark-defun + python-nav-backward-block + python-nav-backward-defun + python-nav-backward-sexp + python-nav-backward-sexp-safe + python-nav-backward-statement + python-nav-backward-up-list + python-nav-beginning-of-block + python-nav-beginning-of-statement + python-nav-end-of-block + python-nav-end-of-defun + python-nav-end-of-statement + python-nav-forward-block + python-nav-forward-defun + python-nav-forward-sexp + python-nav-forward-sexp-safe + python-nav-forward-statement + python-nav-if-name-main + python-nav-up-list + python-shell-send-buffer + python-shell-send-defun + python-shell-send-statement)) + (put sym 'completion-predicate (lambda (_ buffer) + (provided-mode-derived-p + (buffer-local-value 'major-mode buffer) + 'python-mode)))) + +(dolist (sym '(python-describe-at-point + python-eldoc-at-point + python-shell-completion-native-toggle + python-shell-completion-native-turn-off + python-shell-completion-native-turn-on + python-shell-completion-native-turn-on-maybe + python-shell-font-lock-cleanup-buffer + python-shell-font-lock-toggle + python-shell-font-lock-turn-off + python-shell-font-lock-turn-on + python-shell-package-enable + python-shell-completion-complete-or-indent )) + (put sym 'completion-predicate (lambda (_ buffer) + (provided-mode-derived-p + (buffer-local-value 'major-mode buffer) + 'python-mode 'inferior-python-mode)))) + (provide 'python) ;;; python.el ends here -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0004-python-mode-Remove-special-outline-heading-end-regex.patch >From fbd4cc631f1986a631da8619f58db2da62cbf578 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sat, 13 Aug 2022 18:55:48 +0200 Subject: [PATCH 4/4] python-mode: Remove special outline-heading-end-regexp It doesn't work well with the new type annotation syntax introduced in Python 3.5, see bug#53913. * lisp/progmodes/python.el (python-mode): Remove buffer-local setting of outline-heading-end-regexp. --- lisp/progmodes/python.el | 1 - 1 file changed, 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a373390d94..8eb28eb19e 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5854,7 +5854,6 @@ python-mode nil)) (setq-local outline-regexp (python-rx (* space) block-start)) - (setq-local outline-heading-end-regexp ":[^\n]*\n") (setq-local outline-level (lambda () "`outline-level' function for Python mode." -- 2.37.1 --=-=-= Content-Type: text/plain On Sat, 13 Aug 2022 at 11:26, Stefan Kangas wrote: >> Subject: [PATCH 2/4] python.el: Adjustments to Flymake back-end > > How about: > > python.el: Support pyflakes 2.4+ in flymake > This commit includes a second change advertising the possibility to use the pylint program. Moreover, I'm not claiming that pyflakes changed in version 2.4; the change probably happened further in the past. So I made this statement less specific. (BTW, instead of writing things like "To use `flake8' you would set this to ..." in a docstring, wouldn't it make sense for describe-variable to list the suggested customization values from the :type specification?) > Maybe include an example of the old/new pattern in comments? Or even > better actually: add a test for it. I've added some tests. >> From 95675a3f63bc420813992d7b599e99b303e4fd63 Mon Sep 17 00:00:00 2001 >> From: Augusto Stoffel >> Date: Sat, 13 Aug 2022 18:10:14 +0200 >> Subject: [PATCH 3/4] python.el: Add completion-predicate symbol property to >> commands >> >> * lisp/progmodes/python.el: Add a completion-predicate property to >> most commands defined in this file; some are only useful in >> python-mode, others in inferior-python mode as well. >> (python-skeleton-define, python-define-auxiliary-skeleton): Add >> appropriate completion-predicate properties. > > This makes sense, but how about just creating a new mode > python-common-mode that both python-mode and inferior-python-mode could > inherit from? Would that simplify things here? In any case there are two cases to consider anyway: commands that only make sense in Python source code, and commands that make sense in code or in the REPL (we might eventually have code that makes sense just in the REPL, that's not the case now). So for the current purposes this suggestion wouldn't really simplify anything. > I'm fine with this as `outline-heading-end-regexp' doesn't seem to see > much use in any case (and folding to one line somehow seems nicer > anyways). > > However, it seems like we might be able to do find a fix here with just > a small number of assumptions, if we really wanted to. I guess the fix would be not to look for the next colon, but instead to the next colon skipping over pairs of delimiters. But then we couldn't use regexps, and moreover things wouldn't work on incomplete code during editing. And I also think folding on one line makes just as much sense, if it isn't better. So it looks like removing this is the best option. --=-=-=-- From unknown Sat Jun 14 19:43:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#57184: [PATCH] Assorted improvements to python.el Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Aug 2022 13:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57184 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Augusto Stoffel Cc: 57184@debbugs.gnu.org Received: via spool by 57184-submit@debbugs.gnu.org id=B57184.16609155538139 (code B ref 57184); Fri, 19 Aug 2022 13:26:02 +0000 Received: (at 57184) by debbugs.gnu.org; 19 Aug 2022 13:25:53 +0000 Received: from localhost ([127.0.0.1]:57578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oP20W-00027B-K7 for submit@debbugs.gnu.org; Fri, 19 Aug 2022 09:25:53 -0400 Received: from mail-vs1-f47.google.com ([209.85.217.47]:37676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oP20S-00026w-IZ for 57184@debbugs.gnu.org; Fri, 19 Aug 2022 09:25:50 -0400 Received: by mail-vs1-f47.google.com with SMTP id z185so4457865vsb.4 for <57184@debbugs.gnu.org>; Fri, 19 Aug 2022 06:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:user-agent:references:in-reply-to:from:from:to:cc; bh=1m36ONTlgMMthRJjm0uyX2a2R+pYAxYnQt3RiZjuFEI=; b=QN2IOHvvh4BNWfWDMkUa78muNfQlkXTwEbZaQsMc1tZbMi5ybIAeuAvFikqMIH/zR2 rcTMc4XPiQMfbXEOrmo1Zz4Ddv0SeKvvajA2IcqfIPLskcN2L6DEObrlROVDIMxEMSrx 0kF4pR74TxQwB9Eg8vbpyePDxf3bGyunfX6olksKy3zD5v+/Tm1eCeEuRB7fdmyWDrKQ 3weax8D7svwsEr39rCTfLUWXO5MDnno3uHFt57JIGr9E6FHhCOX4XuaMm7cnyeNqv33J 6BJohc1QbnfMxpL2jOD+8CXasJcGOzwUnJZ0aUkuvVD5p6Ol8T64esbjnVU5N7XEp1+y S14A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:user-agent:references:in-reply-to:from :x-gm-message-state:from:to:cc; bh=1m36ONTlgMMthRJjm0uyX2a2R+pYAxYnQt3RiZjuFEI=; b=1OEN2Rz0bPPAFbfRZWS6GMk1e7tE6bAdum06yE5PpMs68f3OeRbPYuTHNMZl4wU5E7 Cindspw5HsGJVfo0BzyTRr8yHHso2o9mWCPwJwj53yfXXCuq1Exlwka4RVzdVT0JJ2Ur 5tmIh2MrbCXqrI30IfYmxBSboUA/M66xAKvqVT78MASf2yeHz9Ky1dTUX3WXeQXUfrn4 wLV6kQTpUd3t7/T4BuIUXZ04V5Ps301QOdQAcYT8IhIH7KoNTIsquDO0InIbrYV5IRPs iILIwjJloSKhkoMWA4LFYfhd3W+9vgaOj9xwB5xyW9qM23nk+TOxfoqdUfEX7ZIFBYCo BRRw== X-Gm-Message-State: ACgBeo04qDEICbyMR59cUJQ92NHnfINRr/Ls7Xry3HeomfGXX4WQpo8o UTzAkDcVt7UIQ3R+vYO9dMkfxc17tU7crDzgsH0= X-Google-Smtp-Source: AA6agR64hjG+zUeKrAA8PILIk7920hhwM+Yrmu7axnfqRHCq2AyUmc+WEPLV2aMGlLTJevhslgfd4Xh94kCjyU5lxIM= X-Received: by 2002:a67:ff85:0:b0:387:473f:9056 with SMTP id v5-20020a67ff85000000b00387473f9056mr2886503vsq.85.1660915542036; Fri, 19 Aug 2022 06:25:42 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 19 Aug 2022 06:25:41 -0700 From: Stefan Kangas In-Reply-To: <87zgg75i8s.fsf@gmail.com> (Augusto Stoffel's message of "Sun, 14 Aug 2022 10:42:11 +0200") References: <875yiw9ipp.fsf@gmail.com> <87zgg75i8s.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) X-Hashcash: 1:20:220819:arstoffel@gmail.com::ugpoXhlspAzdy/fM:6z0/ MIME-Version: 1.0 Date: Fri, 19 Aug 2022 06:25:41 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Augusto Stoffel writes: > I've attached new patches, see below for comments on your comments. (As > to the smaller style changes, feel free to copyedit my patches before > merging in case I still let something slip.) Thanks! Patches 1-2 and 4 LGTM, so I've pushed them to master. Patch 3 seems to break "make bootstrap" with: In toplevel form: cedet/semantic/wisent/python.el:30:2: Error: Symbol=E2=80=99s function definition is void: closure make[3]: *** [Makefile:321: cedet/semantic/wisent/python.elc] Error 1 In toplevel form: org/ob-python.el:33:2: Error: Symbol=E2=80=99s function definition is v= oid: closure make[3]: *** [Makefile:321: org/ob-python.elc] Error 1 Could you take a look at it? From unknown Sat Jun 14 19:43:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#57184: [PATCH] Assorted improvements to python.el Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Aug 2022 13:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57184 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Augusto Stoffel Cc: 57184@debbugs.gnu.org Received: via spool by 57184-submit@debbugs.gnu.org id=B57184.16609164129461 (code B ref 57184); Fri, 19 Aug 2022 13:41:02 +0000 Received: (at 57184) by debbugs.gnu.org; 19 Aug 2022 13:40:12 +0000 Received: from localhost ([127.0.0.1]:57608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oP2EN-0002SW-Rd for submit@debbugs.gnu.org; Fri, 19 Aug 2022 09:40:12 -0400 Received: from mail-vk1-f177.google.com ([209.85.221.177]:47021) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oP2EH-0002Rf-0X for 57184@debbugs.gnu.org; Fri, 19 Aug 2022 09:40:08 -0400 Received: by mail-vk1-f177.google.com with SMTP id h3so466159vko.13 for <57184@debbugs.gnu.org>; Fri, 19 Aug 2022 06:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:user-agent:references:in-reply-to:from:from:to:cc; bh=6E5ZiwqjC2/xWkKCveEGGl5K99EVio3g0NI32dNTuXE=; b=IkBAEwYe0h5/hrhe9rCOQRXxuqRM4eKDFd2jK1YDmDpmhxlHwBMK0hnmM2STEUpiC4 4a5Ovz0uiJECn6LFD8KdBeoBUejzot8OL2HhJkqY2FmUBIbnosfYJslrQUQWcCMtXWWd S5gK7JhAUa/07dpjotsajnTCA3VUgX0w+Rm6jL6R133GCmO03KDGgMDwzntgigk9K01T CQQfKPAtsEC9f2EEBBWHuLPNlYr8/Xv2qFJebseUIJ2SqoPoI8W0m6U+4c1rxO5nmKGF G/pOTLKjMewrRpgtH2rRlOuA/Gc8KSJasQ2Wkx4P8kWCwofk2P+5bf5sbyBCa/qG2tIC Rp1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:user-agent:references:in-reply-to:from :x-gm-message-state:from:to:cc; bh=6E5ZiwqjC2/xWkKCveEGGl5K99EVio3g0NI32dNTuXE=; b=C7IHydIAn1Bjd91CGWqwJr22ev40xstpK9ts/6qvsBA1Oq/blttvjtF4pAxb5DKZFO 0sbBe+qxG+Z0XIrUslVXLWK2CT5jiTH7y2UHyCV5TWfzBn1j7WLlXzLQSWTvKXSIVnOm u2thCnJt05aQK4rGxGDKahO7egbYibrI3uY92trB8mdnWw/tZPUsl8ru+gP3P4Nd0CK3 1sPxVe38nuSUoXor0wcari/6CdE1+KRb+GjKzzMrScCCieV/e20IKbiFUbCLpYP9rGvn tmz1VkQTdnogDgWvANEv7gmb5R6cALLNO12OVa/SArI/xrz0sAxEiZ7GRfZXsHunrWO0 Wm4Q== X-Gm-Message-State: ACgBeo2ZeWXJ7NmPnPrrx0Qbq4/WY1x3Ftf5BW7cwvsGxtivxrmJ4SWP BsAbdF3Afb0wY/XK6D00l+iQPSmcagQBznNIIoY= X-Google-Smtp-Source: AA6agR7J8kP7kddnFYc/01sjIa5H4v18gRUeAOAkRJcXghD6DHVsyfLjF8oVgiblPy5d/KzAJpASQqiclZcGc0qxI7c= X-Received: by 2002:a05:6122:235:b0:379:35ae:8fa3 with SMTP id e21-20020a056122023500b0037935ae8fa3mr3143386vko.41.1660916399450; Fri, 19 Aug 2022 06:39:59 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 19 Aug 2022 06:39:58 -0700 From: Stefan Kangas In-Reply-To: (Stefan Kangas's message of "Fri, 19 Aug 2022 06:25:41 -0700") References: <875yiw9ipp.fsf@gmail.com> <87zgg75i8s.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) X-Hashcash: 1:20:220819:arstoffel@gmail.com::rByjCUJYBN+C4k/x:4i5b MIME-Version: 1.0 Date: Fri, 19 Aug 2022 06:39:58 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 57184 29.1 thanks > Patch 3 seems to break "make bootstrap" with: > > In toplevel form: > cedet/semantic/wisent/python.el:30:2: Error: Symbol=E2=80=99s functio= n > definition is void: closure > make[3]: *** [Makefile:321: cedet/semantic/wisent/python.elc] Error 1 > > In toplevel form: > org/ob-python.el:33:2: Error: Symbol=E2=80=99s function definition is= void: closure > make[3]: *** [Makefile:321: org/ob-python.elc] Error 1 > > Could you take a look at it? I fixed it by changing the completion-predicate lambda into a defun. Now pushed to master with that change. Thanks! From unknown Sat Jun 14 19:43:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#57184: [PATCH] Assorted improvements to python.el Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Aug 2022 16:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57184 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: 57184@debbugs.gnu.org Received: via spool by 57184-submit@debbugs.gnu.org id=B57184.166118551113278 (code B ref 57184); Mon, 22 Aug 2022 16:26:01 +0000 Received: (at 57184) by debbugs.gnu.org; 22 Aug 2022 16:25:11 +0000 Received: from localhost ([127.0.0.1]:41593 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQAEg-0003S5-KS for submit@debbugs.gnu.org; Mon, 22 Aug 2022 12:25:11 -0400 Received: from mail-ej1-f54.google.com ([209.85.218.54]:44567) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQAEb-0003RQ-7E for 57184@debbugs.gnu.org; Mon, 22 Aug 2022 12:25:09 -0400 Received: by mail-ej1-f54.google.com with SMTP id ce26so6545511ejb.11 for <57184@debbugs.gnu.org>; Mon, 22 Aug 2022 09:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc; bh=wM/SiUImVXP6OFD9G3rGlq2hD7s1cuj4xTC2upQizjc=; b=Cypmx0yMUA1Sx5bhAaSBNlOegVMAmxbPYqZ3349e9gVEutVbkY2pTmaoEIGbV+0MKY j9FAyN7D5IthkqoTFLCC+m4ClSWWH0g5q/ooicJBUaan7lSQqFHHcdQZQZrEPbsEd+2G 9rDLvt7gSYQGcA1VOqncgWPCef1f1bGBlSiqR5kaDu0Vue/t1K1KCKwxlb4zWs5keNxS 4OXG2fNzx/NZ1YhRTqPbuUfy93hUPHD2w9p4Tib18zqGx4n1tw+es23LQwm00R3OrN1/ bteTauO7rHZlEK+rVpEYogyc2gSBa6UW4WesgM+4i0xQNEfpLaqVk+5I6jdaINBUIxp/ PkHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc; bh=wM/SiUImVXP6OFD9G3rGlq2hD7s1cuj4xTC2upQizjc=; b=QI9/g4pDmbC8ZqQQ1by7icxdKrsr3dfIb8yemo9y6w00W4GlpHgRVDhQtCLp6a17ao pRg5UnEw6ojgPwC4FhlCjPsaJMR00X9dPV0mmwfGqZuAHkruSOMdX3eM7+dQ9sJUb5Br 0rnMbuerURTrsofwSZPGfx+IVQWkB+T+iSwPxb4qHEiKFtc1xthuULSZnWz9wtRLRtBF 9ZuNBtwibMjUWJ7gihdtA9eli6IoJsj1EOXhDI3IS27dGmhe6hfmqlHQGSK3iCW8uYDz f0c7mEdsAxE0MJHHCXGUPgqBBYWqCydaP33jcLaAz8qVZIjiczEj6zTWyY72DCNv6OVJ dddA== X-Gm-Message-State: ACgBeo3dYEVXA5IkDDWpK+K8IujJRm3DGmXX600z+F0v1jMN0U9AGC8Y tP+3X3PLmJj3nmZ5WgL0xZ6t/eVET+c= X-Google-Smtp-Source: AA6agR4+9Qhqvz0zZYQlsUh9+vl60KkJsBGKxycIu1JbFIS15qeU8TJAur8TuP7rU+zhyoLAhrDMiA== X-Received: by 2002:a17:907:2cf8:b0:730:d739:dc00 with SMTP id hz24-20020a1709072cf800b00730d739dc00mr13843367ejc.423.1661185499048; Mon, 22 Aug 2022 09:24:59 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::157b]) by smtp.gmail.com with ESMTPSA id 18-20020a170906309200b0073d2cb69347sm4922808ejv.192.2022.08.22.09.24.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 09:24:58 -0700 (PDT) From: Augusto Stoffel In-Reply-To: (Stefan Kangas's message of "Fri, 19 Aug 2022 06:39:58 -0700") References: <875yiw9ipp.fsf@gmail.com> <87zgg75i8s.fsf@gmail.com> Date: Mon, 22 Aug 2022 18:24:57 +0200 Message-ID: <87r1185jqe.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, 19 Aug 2022 at 06:39, Stefan Kangas wrote: > > close 57184 29.1 > thanks > >> Patch 3 seems to break "make bootstrap" with: >> >> In toplevel form: >> cedet/semantic/wisent/python.el:30:2: Error: Symbol=E2=80=99s functi= on >> definition is void: closure >> make[3]: *** [Makefile:321: cedet/semantic/wisent/python.elc] Error 1 >> >> In toplevel form: >> org/ob-python.el:33:2: Error: Symbol=E2=80=99s function definition i= s void: closure >> make[3]: *** [Makefile:321: org/ob-python.elc] Error 1 >> >> Could you take a look at it? > > I fixed it by changing the completion-predicate lambda into a defun. > Now pushed to master with that change. Thanks! Thanks for looking into this! So the compilation problem seems to be caused by lambda forms that are evaluated at the time the file is loaded. I'd have slight preference for keeping the lambdas, among other things because they are kind of a provisional solution and could be deleted in a decade or so when we can rely on the (interactive ARG . MODES) feature. So I wonder -- why did we get those compilation errors? Sounds like a bug somewhere else to me. Also, a slight fix is needed, see attached patch. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-completion-predicate-of-Python-shell-commands.patch >From 8ada860fae0a8784500ea03b375f63bf6884b9cd Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Mon, 22 Aug 2022 18:16:50 +0200 Subject: [PATCH] Fix completion-predicate of Python shell commands * lisp/progmodes/python.el: Change some completion predicates. (python-shell--completion-predicate): New completion predicate function. --- lisp/progmodes/python.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a545240805..e1347754c4 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5897,6 +5897,7 @@ python-mode (add-hook 'flymake-diagnostic-functions #'python-flymake nil t)) ;;; Completion predicates for M-x +;; Commands that only make sense when editing Python code (dolist (sym '(python-check python-fill-paragraph python-indent-dedent-line @@ -5928,6 +5929,13 @@ python-mode python-shell-send-statement)) (put sym 'completion-predicate #'python--completion-predicate)) +(defun python-shell--completion-predicate (_ buffer) + (provided-mode-derived-p + (buffer-local-value 'major-mode buffer) + 'python-mode 'inferior-python-mode)) + +;; Commands that only make sense in the Python shell or when editing +;; Python code. (dolist (sym '(python-describe-at-point python-eldoc-at-point python-shell-completion-native-toggle @@ -5940,7 +5948,7 @@ python-mode python-shell-font-lock-turn-on python-shell-package-enable python-shell-completion-complete-or-indent )) - (put sym 'completion-predicate #'python--completion-predicate)) + (put sym 'completion-predicate #'python-shell--completion-predicate)) (provide 'python) -- 2.37.2 --=-=-=-- From unknown Sat Jun 14 19:43:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#57184: [PATCH] Assorted improvements to python.el Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Aug 2022 03:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57184 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Augusto Stoffel Cc: 57184@debbugs.gnu.org Received: via spool by 57184-submit@debbugs.gnu.org id=B57184.166122483829289 (code B ref 57184); Tue, 23 Aug 2022 03:21:02 +0000 Received: (at 57184) by debbugs.gnu.org; 23 Aug 2022 03:20:38 +0000 Received: from localhost ([127.0.0.1]:42177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQKSz-0007cL-S0 for submit@debbugs.gnu.org; Mon, 22 Aug 2022 23:20:38 -0400 Received: from mail-vk1-f179.google.com ([209.85.221.179]:46001) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQKSw-0007c8-Lh for 57184@debbugs.gnu.org; Mon, 22 Aug 2022 23:20:36 -0400 Received: by mail-vk1-f179.google.com with SMTP id t64so6522227vkb.12 for <57184@debbugs.gnu.org>; Mon, 22 Aug 2022 20:20:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc; bh=Ic/qkYOkMJVC1FhjkhS8FzueLa/9S7lS09qNg6kNImg=; b=BIKpABC8Nri8xfimdYamVL9dOtBc/1u+fULKR+rbMdYL0G1aDqjtbSY7FDvAmmv4zx /YPYr+v4fxxQFoF3zpHne/1ddmXH2vw+YRyW9mHYF9f9rO2mlqtlYbhIDiysP8kZ5jlm 7KVPhX2gkGXAyWNXbCJBrteDI+fadOtPzDLvLUz67i3hTf7GQi/QDhbybH0PoZHsPNIO pocGX8OC/+YYcI8FL7SDGr/txSRhk0ojcA7X/K8wmB918U6TAnjJlli4H+TiSxW1JPQR efUat5Cv3Z7CUEHpfM/mzeX95BWwOT1zH+BFP79zfJkXL0tP3SuBmt6sfcBuupXBLjIi IT9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc; bh=Ic/qkYOkMJVC1FhjkhS8FzueLa/9S7lS09qNg6kNImg=; b=sjinuTTqPXBLU1ph8DrAZja7lLJeltHOZHfruSafV6XVKY993mhoZafJvN1RwKAa/z XxFXdBf/1zs86RcuFvwDa2nUS3qawAJPrlXt9WcX5JCnGJ3oXYtp6X+tppCjjIbLZefC Um/9KriifgKBkdwV+YFTkhCX/BlLQz/FUoJCwlY2FMfOXW/DdbVz5E8reZlskqkEnZ74 WW0ApqO9wUpAzKiTWcx/cqgBfeLg13Q2OXBYPRLz77ElRl9vswElWKVw01KqM0ZXmLJq P81Lcuk0WFLFCtXMBsR6lNmJVX3vrvw5DPBMSE8qqn3itqVed8ToKvYJeRFblS3lekTD vsmA== X-Gm-Message-State: ACgBeo3Ah4pTTSZz/by1ZmZy3WtJGumVY6PGF/QDVgIV8/F5q8LjQdGe PU86ZWjUL/NoCIKEPYkjKvjsO+4cK6nbh3MwisQ= X-Google-Smtp-Source: AA6agR6HW8eYTH0iChn9s4oaGS2wKvCvZuZowDLUF5VWNHXewCB5sEFj4RFZx0MfP4MMhLc95XWrsbpBE1/RDeU7tZA= X-Received: by 2002:a1f:51c2:0:b0:37c:f131:e749 with SMTP id f185-20020a1f51c2000000b0037cf131e749mr8448207vkb.38.1661224829090; Mon, 22 Aug 2022 20:20:29 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 22 Aug 2022 20:20:28 -0700 From: Stefan Kangas In-Reply-To: <87r1185jqe.fsf@gmail.com> References: <875yiw9ipp.fsf@gmail.com> <87zgg75i8s.fsf@gmail.com> <87r1185jqe.fsf@gmail.com> X-Hashcash: 1:20:220823:arstoffel@gmail.com::0yl1FrtNoJV2ue5g:02PY MIME-Version: 1.0 Date: Mon, 22 Aug 2022 20:20:28 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Augusto Stoffel writes: > So the compilation problem seems to be caused by lambda forms that are > evaluated at the time the file is loaded. I'd have slight preference > for keeping the lambdas, among other things because they are kind of a > provisional solution and could be deleted in a decade or so when we can > rely on the (interactive ARG . MODES) feature. > > So I wonder -- why did we get those compilation errors? Sounds like a > bug somewhere else to me. To be honest, I didn't look into it as my preference was for a function instead of a lambda. ;-) But if you feel like investigating, please go ahead. I also won't protest if you subsequently want to get rid of the named defun and re-introduce the lambdas. > Also, a slight fix is needed, see attached patch. Thanks, pushed to master (commit fd97cc8e0d).