diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3ac871981e4..ffb2e66ca9d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1652,6 +1652,8 @@ uniqueness for different types of configurations." | |||
| 1652 | OUTPUT is a string with the contents of the buffer." | 1652 | OUTPUT is a string with the contents of the buffer." |
| 1653 | (ansi-color-filter-apply output)) | 1653 | (ansi-color-filter-apply output)) |
| 1654 | 1654 | ||
| 1655 | (defvar python-shell--parent-buffer nil) | ||
| 1656 | |||
| 1655 | (define-derived-mode inferior-python-mode comint-mode "Inferior Python" | 1657 | (define-derived-mode inferior-python-mode comint-mode "Inferior Python" |
| 1656 | "Major mode for Python inferior process. | 1658 | "Major mode for Python inferior process. |
| 1657 | Runs a Python interpreter as a subprocess of Emacs, with Python | 1659 | Runs a Python interpreter as a subprocess of Emacs, with Python |
| @@ -1674,6 +1676,12 @@ initialization of the interpreter via `python-shell-setup-codes' | |||
| 1674 | variable. | 1676 | variable. |
| 1675 | 1677 | ||
| 1676 | \(Type \\[describe-mode] in the process buffer for a list of commands.)" | 1678 | \(Type \\[describe-mode] in the process buffer for a list of commands.)" |
| 1679 | (and python-shell--parent-buffer | ||
| 1680 | (python-util-clone-local-variables python-shell--parent-buffer)) | ||
| 1681 | (setq comint-prompt-regexp (format "^\\(?:%s\\|%s\\|%s\\)" | ||
| 1682 | python-shell-prompt-regexp | ||
| 1683 | python-shell-prompt-block-regexp | ||
| 1684 | python-shell-prompt-pdb-regexp)) | ||
| 1677 | (set-syntax-table python-mode-syntax-table) | 1685 | (set-syntax-table python-mode-syntax-table) |
| 1678 | (setq mode-line-process '(":%s")) | 1686 | (setq mode-line-process '(":%s")) |
| 1679 | (make-local-variable 'comint-output-filter-functions) | 1687 | (make-local-variable 'comint-output-filter-functions) |
| @@ -1721,15 +1729,10 @@ killed." | |||
| 1721 | (let* ((cmdlist (split-string-and-unquote cmd)) | 1729 | (let* ((cmdlist (split-string-and-unquote cmd)) |
| 1722 | (buffer (apply #'make-comint-in-buffer proc-name proc-buffer-name | 1730 | (buffer (apply #'make-comint-in-buffer proc-name proc-buffer-name |
| 1723 | (car cmdlist) nil (cdr cmdlist))) | 1731 | (car cmdlist) nil (cdr cmdlist))) |
| 1724 | (current-buffer (current-buffer)) | 1732 | (python-shell--parent-buffer (current-buffer)) |
| 1725 | (process (get-buffer-process buffer))) | 1733 | (process (get-buffer-process buffer))) |
| 1726 | (with-current-buffer buffer | 1734 | (with-current-buffer buffer |
| 1727 | (inferior-python-mode) | 1735 | (inferior-python-mode)) |
| 1728 | (python-util-clone-local-variables current-buffer) | ||
| 1729 | (setq comint-prompt-regexp (format "^\\(?:%s\\|%s\\|%s\\)" | ||
| 1730 | python-shell-prompt-regexp | ||
| 1731 | python-shell-prompt-block-regexp | ||
| 1732 | python-shell-prompt-pdb-regexp))) | ||
| 1733 | (accept-process-output process) | 1736 | (accept-process-output process) |
| 1734 | (and pop (pop-to-buffer buffer t)) | 1737 | (and pop (pop-to-buffer buffer t)) |
| 1735 | (and internal (set-process-query-on-exit-flag process nil)))) | 1738 | (and internal (set-process-query-on-exit-flag process nil)))) |