emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 45aabe6eda: Disable completion when PDB is active in Python Shell


From: Lars Ingebrigtsen
Subject: master 45aabe6eda: Disable completion when PDB is active in Python Shell buffer
Date: Sun, 16 Oct 2022 05:15:36 -0400 (EDT)

branch: master
commit 45aabe6edae8d841a8985853394baddad4a1949e
Author: kobarity <kobarity@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Disable completion when PDB is active in Python Shell buffer
    
    * lisp/progmodes/python.el (python-shell-completion-at-point): Disable
    completion in Python buffer when PDB is active in Python Shell buffer.
    * test/lisp/progmodes/python-tests.el (python-shell-completion-pdb-1):
    New test (bug#58562).
---
 lisp/progmodes/python.el            |  5 ++++-
 test/lisp/progmodes/python-tests.el | 17 +++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 0de76b0bde..50f1e6752e 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -4102,7 +4102,10 @@ using that one instead of current buffer's process."
           (with-current-buffer (process-buffer process)
             (cond ((or (null prompt)
                        (and is-shell-buffer
-                            (< (point) (cdr prompt-boundaries))))
+                            (< (point) (cdr prompt-boundaries)))
+                       (and (not is-shell-buffer)
+                            (string-match-p
+                             python-shell-prompt-pdb-regexp prompt)))
                    #'ignore)
                   ((or (not python-shell-completion-native-enable)
                        ;; Even if native completion is enabled, for
diff --git a/test/lisp/progmodes/python-tests.el 
b/test/lisp/progmodes/python-tests.el
index 9ad2d16930..97dc17ce29 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -4427,6 +4427,23 @@ import abc
      (insert "abc.")
      (should (completion-at-point)))))
 
+(ert-deftest python-shell-completion-pdb-1 ()
+  "Should not complete PDB commands in Python buffer."
+  (skip-unless (executable-find python-tests-shell-interpreter))
+  (python-tests-with-temp-buffer-with-shell
+   "
+import pdb
+
+pdb.set_trace()
+print('Hello')
+"
+   (let ((inhibit-message t))
+     (python-shell-send-buffer)
+     (python-tests-shell-wait-for-prompt)
+     (goto-char (point-max))
+     (insert "u")
+     (should-not (nth 2 (python-completion-at-point))))))
+
 (ert-deftest python-shell-completion-native-1 ()
   (skip-unless (executable-find python-tests-shell-interpreter))
   (python-tests-with-temp-buffer-with-shell



reply via email to

[Prev in Thread] Current Thread [Next in Thread]