[Top][All Lists]

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

bug#31398: 27.0.50; run-python doesn't make the python buffer the curren

From: Tino Calancha
Subject: bug#31398: 27.0.50; run-python doesn't make the python buffer the current one
Date: Thu, 10 May 2018 16:37:02 +0900

emacs -Q
M-x run-python RET
;; displayes *Python* buffer; it doesn't select the window showing that buffer.

C-x 1
M-x run-python RET
;; The existent buffer *Python* us not shown

Following commands: `run-lisp', `run-ruby', `run-scheme'
behaves as follows:
I) They make the buffer running the inferior program the current buffer.
II) Same as I)

In Emacs-24
I) for `run-python' makes the python buffer the current.

--8<-----------------------------cut here---------------start------------->8---
commit e39147fc09e8749292c448aecf0c839a3aa3a651
Author: Tino Calancha <address@hidden>
Date:   Thu May 10 16:28:00 2018 +0900

    run-lisp: 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
    * test/lisp/progmodes/python-tests.el (python-tests--bug31398):
    Add test.

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 32d645cfcc..01af500786 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2842,10 +2842,12 @@ run-python
         (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-same-window buffer)
+    (get-buffer-process buffer)))
 (defun run-python-internal ()
   "Run an inferior Internal Python process.
diff --git a/test/lisp/progmodes/python-tests.el 
index 4955da02a2..dd1c45914e 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -5352,7 +5352,14 @@ python-tests-shell-interpreter
     (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)
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 27.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2018-05-06 built on calancha-pc
Repository revision: 766b057e41df7316808ec7658836fda75facda75

reply via email to

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