emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master b015fb0: run-python: Make the buffer running python


From: Tino Calancha
Subject: [Emacs-diffs] master b015fb0: run-python: Make the buffer running python current
Date: Mon, 14 May 2018 12:32:23 -0400 (EDT)

branch: master
commit b015fb0ce37235480af8d80bce8c2f9b7e6258eb
Author: Tino Calancha <address@hidden>
Commit: Tino Calancha <address@hidden>

    run-python: Make the buffer running python current
    
    * lisp/progmodes/python.el (run-python, python-shell-make-comint):
    Make the buffer running the inferior python process the current buffer
    (Bug#31398).
    * test/lisp/progmodes/python-tests.el (python-tests--bug31398):
    Add test.
---
 lisp/progmodes/python.el            | 10 ++++++----
 test/lisp/progmodes/python-tests.el |  8 ++++++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 32d645c..a09ca2f 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2842,10 +2842,12 @@ process buffer for a list of commands.)"
         (y-or-n-p "Make dedicated process? ")
         (= (prefix-numeric-value current-prefix-arg) 4))
      (list (python-shell-calculate-command) nil t)))
-  (get-buffer-process
-   (python-shell-make-comint
-    (or cmd (python-shell-calculate-command))
-    (python-shell-get-process-name dedicated) show)))
+  (let ((buffer
+         (python-shell-make-comint
+          (or cmd (python-shell-calculate-command))
+          (python-shell-get-process-name dedicated) show)))
+    (pop-to-buffer buffer)
+    (get-buffer-process buffer)))
 
 (defun run-python-internal ()
   "Run an inferior Internal Python process.
diff --git a/test/lisp/progmodes/python-tests.el 
b/test/lisp/progmodes/python-tests.el
index 4955da0..dd1c459 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -5352,6 +5352,14 @@ buffer with overlapping strings."
                     (python-nav-end-of-statement)))
     (should (eolp))))
 
+;; After call `run-python' the buffer running the python process is current.
+(ert-deftest python-tests--bug31398 ()
+  "Test for https://debbugs.gnu.org/31398 ."
+  (let ((buffer (process-buffer (run-python nil nil 'show))))
+    (should (eq buffer (current-buffer)))
+    (pop-to-buffer (other-buffer))
+    (run-python nil nil 'show)
+    (should (eq buffer (current-buffer)))))
 
 (provide 'python-tests)
 



reply via email to

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