diff options
| author | Tino Calancha | 2018-05-15 01:30:11 +0900 |
|---|---|---|
| committer | Tino Calancha | 2018-05-15 01:30:11 +0900 |
| commit | b015fb0ce37235480af8d80bce8c2f9b7e6258eb (patch) | |
| tree | 39ee5a78a3c0a8fe13bbf42652a73301d21eb4e0 | |
| parent | c2caf763cfe3bb85b4933ffac12695a7cb366cd4 (diff) | |
| download | emacs-b015fb0ce37235480af8d80bce8c2f9b7e6258eb.tar.gz emacs-b015fb0ce37235480af8d80bce8c2f9b7e6258eb.zip | |
run-python: 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.
| -rw-r--r-- | lisp/progmodes/python.el | 10 | ||||
| -rw-r--r-- | test/lisp/progmodes/python-tests.el | 8 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 32d645cfcc9..a09ca2f2f29 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -2842,10 +2842,12 @@ process buffer for a list of commands.)" | |||
| 2842 | (y-or-n-p "Make dedicated process? ") | 2842 | (y-or-n-p "Make dedicated process? ") |
| 2843 | (= (prefix-numeric-value current-prefix-arg) 4)) | 2843 | (= (prefix-numeric-value current-prefix-arg) 4)) |
| 2844 | (list (python-shell-calculate-command) nil t))) | 2844 | (list (python-shell-calculate-command) nil t))) |
| 2845 | (get-buffer-process | 2845 | (let ((buffer |
| 2846 | (python-shell-make-comint | 2846 | (python-shell-make-comint |
| 2847 | (or cmd (python-shell-calculate-command)) | 2847 | (or cmd (python-shell-calculate-command)) |
| 2848 | (python-shell-get-process-name dedicated) show))) | 2848 | (python-shell-get-process-name dedicated) show))) |
| 2849 | (pop-to-buffer buffer) | ||
| 2850 | (get-buffer-process buffer))) | ||
| 2849 | 2851 | ||
| 2850 | (defun run-python-internal () | 2852 | (defun run-python-internal () |
| 2851 | "Run an inferior Internal Python process. | 2853 | "Run an inferior Internal Python process. |
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 4955da02a25..dd1c45914e2 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el | |||
| @@ -5352,6 +5352,14 @@ buffer with overlapping strings." | |||
| 5352 | (python-nav-end-of-statement))) | 5352 | (python-nav-end-of-statement))) |
| 5353 | (should (eolp)))) | 5353 | (should (eolp)))) |
| 5354 | 5354 | ||
| 5355 | ;; After call `run-python' the buffer running the python process is current. | ||
| 5356 | (ert-deftest python-tests--bug31398 () | ||
| 5357 | "Test for https://debbugs.gnu.org/31398 ." | ||
| 5358 | (let ((buffer (process-buffer (run-python nil nil 'show)))) | ||
| 5359 | (should (eq buffer (current-buffer))) | ||
| 5360 | (pop-to-buffer (other-buffer)) | ||
| 5361 | (run-python nil nil 'show) | ||
| 5362 | (should (eq buffer (current-buffer))))) | ||
| 5355 | 5363 | ||
| 5356 | (provide 'python-tests) | 5364 | (provide 'python-tests) |
| 5357 | 5365 | ||