]> git.eshelyaron.com Git - emacs.git/commitdiff
Faster comint output.
authorFabián Ezequiel Gallina <fgallina@gnu.org>
Sun, 27 Jul 2014 02:02:38 +0000 (23:02 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Sun, 27 Jul 2014 02:02:38 +0000 (23:02 -0300)
* 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
lisp/ChangeLog
lisp/progmodes/python.el

index 6713626c45739ec73aeea95bcd419091d6f098d7..789ad74e95cec533b903a13a57b2afa2a57e1817 100644 (file)
@@ -1,3 +1,12 @@
+2014-07-27  Fabián Ezequiel Gallina  <fgallina@gnu.org>
+
+       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  <fgallina@gnu.org>
 
        * progmodes/python.el (python-shell-font-lock-post-command-hook):
index 2d4276b2f2b420c3b5c5c91a849a63bdda0ef690..99c3b0ee1f6cc4dceefc45c6ed23d12df4dab1b2 100644 (file)
@@ -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]