From: Fabián Ezequiel Gallina Date: Sun, 27 Jul 2014 02:02:38 +0000 (-0300) Subject: Faster comint output. X-Git-Tag: emacs-25.0.90~2636^3~34 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a6dc66a5441bc6832c12d362edd2d886edc1612a;p=emacs.git 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 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6713626c457..789ad74e95c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2014-07-27 Fabián Ezequiel Gallina + + Faster comint output. (Bug#16875) + * 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. + 2014-07-27 Fabián Ezequiel Gallina * progmodes/python.el (python-shell-font-lock-post-command-hook): 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." (rx eos)) output)) -(defun python-comint-output-filter-function (output) - "Hook run after content is put into comint buffer. -OUTPUT is a string with the contents of the buffer." - (ansi-color-filter-apply output)) +(define-obsolete-function-alias + 'python-comint-output-filter-function + 'ansi-color-filter-apply + "24.5") + +(defun python-comint-postoutput-scroll-to-bottom (output) + "Faster version of `comint-postoutput-scroll-to-bottom'. +Avoids `recenter' calls until OUTPUT is completely sent." + (when (and (not (string= "" output)) + (python-shell-comint-end-of-output-p + (ansi-color-filter-apply output))) + (comint-postoutput-scroll-to-bottom output)) + output) (defvar python-shell--parent-buffer nil) @@ -2281,6 +2290,10 @@ interpreter is run. Variables `python-ffap-setup-code' and `python-ffap-string-code' can customize this mode for different Python interpreters. +This mode resets `comint-output-filter-functions' locally, so you +may want to re-add custom functions to it using the +`inferior-python-mode-hook'. + You can also add additional setup code to be run at initialization of the interpreter via `python-shell-setup-codes' variable. @@ -2300,11 +2313,10 @@ variable. (python-shell-prompt-set-calculated-regexps) (setq comint-prompt-regexp python-shell--prompt-calculated-input-regexp) (setq mode-line-process '(":%s")) - (make-local-variable 'comint-output-filter-functions) - (add-hook 'comint-output-filter-functions - 'python-comint-output-filter-function) - (add-hook 'comint-output-filter-functions - 'python-pdbtrack-comint-output-filter-function) + (set (make-local-variable 'comint-output-filter-functions) + '(ansi-color-process-output + python-pdbtrack-comint-output-filter-function + python-comint-postoutput-scroll-to-bottom)) (set (make-local-variable 'compilation-error-regexp-alist) python-shell-compilation-regexp-alist) (define-key inferior-python-mode-map [remap complete-symbol]