unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31398: 27.0.50; run-python doesn't make the python buffer the current one
@ 2018-05-10  7:37 Tino Calancha
  2018-05-10  7:44 ` Tino Calancha
  2018-05-14 16:34 ` Tino Calancha
  0 siblings, 2 replies; 3+ messages in thread
From: Tino Calancha @ 2018-05-10  7:37 UTC (permalink / raw)
  To: 31398


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

II)
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 <tino.calancha@gmail.com>
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
    (Bug#31398).
    * 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 b/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
                     (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)
 
--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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-14 16:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-10  7:37 bug#31398: 27.0.50; run-python doesn't make the python buffer the current one Tino Calancha
2018-05-10  7:44 ` Tino Calancha
2018-05-14 16:34 ` Tino Calancha

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).