emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117582: Faster comint output.


From: Fabián Ezequiel Gallina
Subject: [Emacs-diffs] trunk r117582: Faster comint output.
Date: Sun, 27 Jul 2014 02:03:23 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117582
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16875
committer: Fabián Ezequiel Gallina <address@hidden>
branch nick: trunk
timestamp: Sat 2014-07-26 23:02:38 -0300
message:
  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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/python.el       python.el-20091113204419-o5vbwnq5f7feedwu-3008
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-07-27 01:00:26 +0000
+++ b/lisp/ChangeLog    2014-07-27 02:02:38 +0000
@@ -1,5 +1,14 @@
 2014-07-27  Fabián Ezequiel Gallina  <address@hidden>
 
+       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  <address@hidden>
+
        * progmodes/python.el (python-shell-font-lock-post-command-hook):
        Safeguard current point and undo history.
 

=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el  2014-07-27 01:00:26 +0000
+++ b/lisp/progmodes/python.el  2014-07-27 02:02:38 +0000
@@ -2114,10 +2114,19 @@
     (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 @@
 `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 @@
   (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]


reply via email to

[Prev in Thread] Current Thread [Next in Thread]