diff options
| author | Fabián Ezequiel Gallina | 2012-07-17 13:47:58 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-07-17 13:47:58 -0300 |
| commit | 191da00ee25cec5d13f257720ef401fc31203384 (patch) | |
| tree | a0f23c460f1d7d3081d96ee9d1a1744acae73199 /lisp/progmodes/python.el | |
| parent | 6d02fe5b3bf3376f0ea6ecf7fed184fbe84ef1b5 (diff) | |
| download | emacs-191da00ee25cec5d13f257720ef401fc31203384.tar.gz emacs-191da00ee25cec5d13f257720ef401fc31203384.zip | |
* progmodes/python.el (python-shell-send-string-no-output): Allow
accept-process-output to quit, keeping shell process ready for
future interactions.
Fixes: debbugs:11868
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index e0a58d1523e..f6a1fbf3ab7 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1701,24 +1701,29 @@ When MSG is non-nil messages the first line of STRING." | |||
| 1701 | "Send STRING to PROCESS and inhibit output. | 1701 | "Send STRING to PROCESS and inhibit output. |
| 1702 | When MSG is non-nil messages the first line of STRING. Return | 1702 | When MSG is non-nil messages the first line of STRING. Return |
| 1703 | the output." | 1703 | the output." |
| 1704 | (let* ((output-buffer) | 1704 | (let* ((output-buffer "") |
| 1705 | (process (or process (python-shell-get-or-create-process))) | 1705 | (process (or process (python-shell-get-or-create-process))) |
| 1706 | (comint-preoutput-filter-functions | 1706 | (comint-preoutput-filter-functions |
| 1707 | (append comint-preoutput-filter-functions | 1707 | (append comint-preoutput-filter-functions |
| 1708 | '(ansi-color-filter-apply | 1708 | '(ansi-color-filter-apply |
| 1709 | (lambda (string) | 1709 | (lambda (string) |
| 1710 | (setq output-buffer (concat output-buffer string)) | 1710 | (setq output-buffer (concat output-buffer string)) |
| 1711 | ""))))) | 1711 | "")))) |
| 1712 | (python-shell-send-string string process msg) | 1712 | (inhibit-quit t)) |
| 1713 | (accept-process-output process) | 1713 | (or |
| 1714 | (replace-regexp-in-string | 1714 | (with-local-quit |
| 1715 | (if (> (length python-shell-prompt-output-regexp) 0) | 1715 | (python-shell-send-string string process msg) |
| 1716 | (format "\n*%s$\\|^%s\\|\n$" | 1716 | (accept-process-output process) |
| 1717 | python-shell-prompt-regexp | 1717 | (replace-regexp-in-string |
| 1718 | (or python-shell-prompt-output-regexp "")) | 1718 | (if (> (length python-shell-prompt-output-regexp) 0) |
| 1719 | (format "\n*$\\|^%s\\|\n$" | 1719 | (format "\n*%s$\\|^%s\\|\n$" |
| 1720 | python-shell-prompt-regexp)) | 1720 | python-shell-prompt-regexp |
| 1721 | "" output-buffer))) | 1721 | (or python-shell-prompt-output-regexp "")) |
| 1722 | (format "\n*$\\|^%s\\|\n$" | ||
| 1723 | python-shell-prompt-regexp)) | ||
| 1724 | "" output-buffer)) | ||
| 1725 | (with-current-buffer (process-buffer process) | ||
| 1726 | (comint-interrupt-subjob))))) | ||
| 1722 | 1727 | ||
| 1723 | (defun python-shell-internal-send-string (string) | 1728 | (defun python-shell-internal-send-string (string) |
| 1724 | "Send STRING to the Internal Python interpreter. | 1729 | "Send STRING to the Internal Python interpreter. |