From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs 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 Message-ID: <87mux8t10h.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1525937774 26136 195.159.176.226 (10 May 2018 07:36:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 10 May 2018 07:36:14 +0000 (UTC) To: 31398@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 10 09:36:10 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fGg7Q-0006cm-8N for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 May 2018 09:36:09 +0200 Original-Received: from localhost ([::1]:60615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGg9X-0004eX-FS for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 May 2018 03:38:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGg9O-0004eQ-Cp for bug-gnu-emacs@gnu.org; Thu, 10 May 2018 03:38:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGg9K-0001gY-DP for bug-gnu-emacs@gnu.org; Thu, 10 May 2018 03:38:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47992) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGg9K-0001fl-9B for bug-gnu-emacs@gnu.org; Thu, 10 May 2018 03:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fGg9K-0000xK-0a for bug-gnu-emacs@gnu.org; Thu, 10 May 2018 03:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 May 2018 07:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 31398 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15259378463625 (code B ref -1); Thu, 10 May 2018 07:38:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 May 2018 07:37:26 +0000 Original-Received: from localhost ([127.0.0.1]:55889 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fGg8i-0000wN-Ig for submit@debbugs.gnu.org; Thu, 10 May 2018 03:37:26 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33248) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fGg8g-0000wA-TK for submit@debbugs.gnu.org; Thu, 10 May 2018 03:37:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGg8a-0000eK-Hy for submit@debbugs.gnu.org; Thu, 10 May 2018 03:37:17 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:41866) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fGg8a-0000eA-ET for submit@debbugs.gnu.org; Thu, 10 May 2018 03:37:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGg8Z-0004c9-35 for bug-gnu-emacs@gnu.org; Thu, 10 May 2018 03:37:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGg8V-0000bX-4v for bug-gnu-emacs@gnu.org; Thu, 10 May 2018 03:37:15 -0400 Original-Received: from mail-pl0-x236.google.com ([2607:f8b0:400e:c01::236]:39133) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGg8U-0000b7-VO for bug-gnu-emacs@gnu.org; Thu, 10 May 2018 03:37:11 -0400 Original-Received: by mail-pl0-x236.google.com with SMTP id c19-v6so802675pls.6 for ; Thu, 10 May 2018 00:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=uQGd5e/cTHTKoOt6ImQIrZmJUTUFzZX6Caw1IVvN8uE=; b=GT9O2rZEEGq8J+9kMqh/M4qrxfuPUuWNlLWifBKmL69R/f1C0f0o2Do4aG8wpQW6Dl P38E7TjGfrFylKLZ3g6qbE60VFgyuaY509WwQzGVLONX8vQsOo/VU0ysXpzvIYtKGx/J Te/S5TEFztKOGFAtSrAej624lbZAbjI6Lg8UzVlmLviygHBZo9paDziQlIq56FtCF1X5 5xTOcEWAWyAqGJ/rKs/GV9Q9OYPxnNZpPtG5Pczx+01MaIa0rmAniaTttcfK2UVLhaGy Wv6JUEiGD8UuvDidXlN5piCXB+1isKJFHGSHe6oNk+XzhUeXTXKO5tV/Fqu5TLA6Pv94 3vAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=uQGd5e/cTHTKoOt6ImQIrZmJUTUFzZX6Caw1IVvN8uE=; b=GL5cEitzs3MGgkrCcktuNNOPccUBAZisUUte71E9Y/7UVWAGM6NXQ0DSH5t7+g01FI K58++RYRGDB1/v8W+WvaxZfqTTYq1+vrUr7oUaBECNv8pZl8iqawP1GT0bN4w/htiM+9 NEAoJ6qwUSqRRMFXIsjrSI9ey73McTYyoaW6TTsoObwJ7EGFExHrd9A9TP/70gQsW88V Mg5ZLFUZM02TR8+iBKGVjo7uRRrvjuPtFJgKd7ksclMxGc3orgwtHZsAAG4TDjbvZPG9 4QtCm2sFdmbkW2/Jtp8VEwJA9aFHBhoeKObcYKBMPNV+aps0+JkrkcPZ/+IQk+sPIyU5 VWnw== X-Gm-Message-State: ALKqPwd10qfJDaOM9DmoeBaOBHOhmpYBzMRH7JgSPUKJ0RGjCwKtgmG8 kSSvQtRDLGmhR3F/Ea0r3hb3Ew== X-Google-Smtp-Source: AB8JxZpSK+icDrrpquYpHXgywKdXelDh/Pz8gvseeTW0Z1MGDWwG/PgX63gQJllvcSkUDAKsh8CYRw== X-Received: by 2002:a17:902:a586:: with SMTP id az6-v6mr343398plb.210.1525937829609; Thu, 10 May 2018 00:37:09 -0700 (PDT) Original-Received: from calancha-pc (228.225.128.101.dy.bbexcite.jp. [101.128.225.228]) by smtp.gmail.com with ESMTPSA id u4-v6sm504348pfh.120.2018.05.10.00.37.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 00:37:08 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:146102 Archived-At: 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 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