diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2d4276b2f2b..99c3b0ee1f6 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -2114,10 +2114,19 @@ uniqueness for different types of configurations." | |||
| 2114 | (rx eos)) | 2114 | (rx eos)) |
| 2115 | output)) | 2115 | output)) |
| 2116 | 2116 | ||
| 2117 | (defun python-comint-output-filter-function (output) | 2117 | (define-obsolete-function-alias |
| 2118 | "Hook run after content is put into comint buffer. | 2118 | 'python-comint-output-filter-function |
| 2119 | OUTPUT is a string with the contents of the buffer." | 2119 | 'ansi-color-filter-apply |
| 2120 | (ansi-color-filter-apply output)) | 2120 | "24.5") |
| 2121 | |||
| 2122 | (defun python-comint-postoutput-scroll-to-bottom (output) | ||
| 2123 | "Faster version of `comint-postoutput-scroll-to-bottom'. | ||
| 2124 | Avoids `recenter' calls until OUTPUT is completely sent." | ||
| 2125 | (when (and (not (string= "" output)) | ||
| 2126 | (python-shell-comint-end-of-output-p | ||
| 2127 | (ansi-color-filter-apply output))) | ||
| 2128 | (comint-postoutput-scroll-to-bottom output)) | ||
| 2129 | output) | ||
| 2121 | 2130 | ||
| 2122 | (defvar python-shell--parent-buffer nil) | 2131 | (defvar python-shell--parent-buffer nil) |
| 2123 | 2132 | ||
| @@ -2281,6 +2290,10 @@ interpreter is run. Variables | |||
| 2281 | `python-ffap-setup-code' and `python-ffap-string-code' can | 2290 | `python-ffap-setup-code' and `python-ffap-string-code' can |
| 2282 | customize this mode for different Python interpreters. | 2291 | customize this mode for different Python interpreters. |
| 2283 | 2292 | ||
| 2293 | This mode resets `comint-output-filter-functions' locally, so you | ||
| 2294 | may want to re-add custom functions to it using the | ||
| 2295 | `inferior-python-mode-hook'. | ||
| 2296 | |||
| 2284 | You can also add additional setup code to be run at | 2297 | You can also add additional setup code to be run at |
| 2285 | initialization of the interpreter via `python-shell-setup-codes' | 2298 | initialization of the interpreter via `python-shell-setup-codes' |
| 2286 | variable. | 2299 | variable. |
| @@ -2300,11 +2313,10 @@ variable. | |||
| 2300 | (python-shell-prompt-set-calculated-regexps) | 2313 | (python-shell-prompt-set-calculated-regexps) |
| 2301 | (setq comint-prompt-regexp python-shell--prompt-calculated-input-regexp) | 2314 | (setq comint-prompt-regexp python-shell--prompt-calculated-input-regexp) |
| 2302 | (setq mode-line-process '(":%s")) | 2315 | (setq mode-line-process '(":%s")) |
| 2303 | (make-local-variable 'comint-output-filter-functions) | 2316 | (set (make-local-variable 'comint-output-filter-functions) |
| 2304 | (add-hook 'comint-output-filter-functions | 2317 | '(ansi-color-process-output |
| 2305 | 'python-comint-output-filter-function) | 2318 | python-pdbtrack-comint-output-filter-function |
| 2306 | (add-hook 'comint-output-filter-functions | 2319 | python-comint-postoutput-scroll-to-bottom)) |
| 2307 | 'python-pdbtrack-comint-output-filter-function) | ||
| 2308 | (set (make-local-variable 'compilation-error-regexp-alist) | 2320 | (set (make-local-variable 'compilation-error-regexp-alist) |
| 2309 | python-shell-compilation-regexp-alist) | 2321 | python-shell-compilation-regexp-alist) |
| 2310 | (define-key inferior-python-mode-map [remap complete-symbol] | 2322 | (define-key inferior-python-mode-map [remap complete-symbol] |