GNU bug report logs - #31398
27.0.50; run-python doesn't make the python buffer the current one

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Thu, 10 May 2018 07:38:01 UTC

Severity: minor

Found in version 27.0.50

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31398 in the body.
You can then email your comments to 31398 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#31398; Package emacs. (Thu, 10 May 2018 07:38:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tino Calancha <tino.calancha <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 10 May 2018 07:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 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
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 <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31398; Package emacs. (Thu, 10 May 2018 07:45:02 GMT) Full text and rfc822 format available.

Message #8 received at 31398 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 31398 <at> debbugs.gnu.org
Subject: Re: bug#31398: 27.0.50;
 run-python doesn't make the python buffer the current one
Date: Thu, 10 May 2018 16:44:45 +0900
Tino Calancha <tino.calancha <at> gmail.com> writes:


I must use `pop-to-buffer', otherwise the buffer is shown in two
windows:
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 01af500786..a09ca2f2f2 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2846,7 +2846,7 @@ run-python
          (python-shell-make-comint
           (or cmd (python-shell-calculate-command))
           (python-shell-get-process-name dedicated) show)))
-    (pop-to-buffer-same-window buffer)
+    (pop-to-buffer buffer)
     (get-buffer-process buffer)))
 
 (defun run-python-internal ()




Reply sent to Tino Calancha <tino.calancha <at> gmail.com>:
You have taken responsibility. (Mon, 14 May 2018 16:35:01 GMT) Full text and rfc822 format available.

Notification sent to Tino Calancha <tino.calancha <at> gmail.com>:
bug acknowledged by developer. (Mon, 14 May 2018 16:35:01 GMT) Full text and rfc822 format available.

Message #13 received at 31398-done <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 31398-done <at> debbugs.gnu.org
Subject: Re: bug#31398: 27.0.50;
 run-python doesn't make the python buffer the current one
Date: Tue, 15 May 2018 01:34:01 +0900
Tino Calancha <tino.calancha <at> gmail.com> writes:

> 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* is not shown
Pushed fix into master branch as commit
'run-python: Make the buffer running python current'
(b015fb0ce37235480af8d80bce8c2f9b7e6258eb)




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 12 Jun 2018 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 151 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.