aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2014-07-26 23:02:38 -0300
committerFabián Ezequiel Gallina2014-07-26 23:02:38 -0300
commita6dc66a5441bc6832c12d362edd2d886edc1612a (patch)
tree5639d2a7ca3e4401a317db05bb39a031ec061449
parentef29dc9b14374bc9f5ef322460625fd44da07410 (diff)
downloademacs-a6dc66a5441bc6832c12d362edd2d886edc1612a.tar.gz
emacs-a6dc66a5441bc6832c12d362edd2d886edc1612a.zip
Faster comint output.
* lisp/progmodes/python.el: (python-comint-output-filter-function): Make obsolete. (python-comint-postoutput-scroll-to-bottom): New function. (inferior-python-mode): Set comint-output-filter-functions to a minimum. Fixes: debbugs:16875
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/progmodes/python.el30
2 files changed, 30 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6713626c457..789ad74e95c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,14 @@
12014-07-27 Fabián Ezequiel Gallina <fgallina@gnu.org> 12014-07-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
2 2
3 Faster comint output. (Bug#16875)
4 * progmodes/python.el:
5 (python-comint-output-filter-function): Make obsolete.
6 (python-comint-postoutput-scroll-to-bottom): New function.
7 (inferior-python-mode): Set comint-output-filter-functions to a
8 minimum.
9
102014-07-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
11
3 * progmodes/python.el (python-shell-font-lock-post-command-hook): 12 * progmodes/python.el (python-shell-font-lock-post-command-hook):
4 Safeguard current point and undo history. 13 Safeguard current point and undo history.
5 14
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
2119OUTPUT 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'.
2124Avoids `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
2282customize this mode for different Python interpreters. 2291customize this mode for different Python interpreters.
2283 2292
2293This mode resets `comint-output-filter-functions' locally, so you
2294may want to re-add custom functions to it using the
2295`inferior-python-mode-hook'.
2296
2284You can also add additional setup code to be run at 2297You can also add additional setup code to be run at
2285initialization of the interpreter via `python-shell-setup-codes' 2298initialization of the interpreter via `python-shell-setup-codes'
2286variable. 2299variable.
@@ -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]