all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: 31398@debbugs.gnu.org
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	[thread overview]
Message-ID: <87mux8t10h.fsf@gmail.com> (raw)


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





             reply	other threads:[~2018-05-10  7:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10  7:37 Tino Calancha [this message]
2018-05-10  7:44 ` bug#31398: 27.0.50; run-python doesn't make the python buffer the current one Tino Calancha
2018-05-14 16:34 ` Tino Calancha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mux8t10h.fsf@gmail.com \
    --to=tino.calancha@gmail.com \
    --cc=31398@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.