emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 02dc8da 1/2: python.el: Fixes for IPython 3.x (Bug#


From: Fabián Ezequiel Gallina
Subject: [Emacs-diffs] master 02dc8da 1/2: python.el: Fixes for IPython 3.x (Bug#20580)
Date: Mon, 06 Jul 2015 05:02:45 +0000

branch: master
commit 02dc8dac7e9a7d3482d63d554bc20b579c74f072
Author: Fabián Ezequiel Gallina <address@hidden>
Commit: Fabián Ezequiel Gallina <address@hidden>

    python.el: Fixes for IPython 3.x  (Bug#20580)
    
    * lisp/progmodes/python.el:
    (python-shell-completion-native-setup): Fix IPython 3.x setup.
    (python-shell-completion-native-get-completions): Fix timeout
    logic.
---
 lisp/progmodes/python.el |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index fbf944f..0fe1aa9 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3171,9 +3171,12 @@ def __PYTHON_EL_native_completion_setup():
             if not is_ipython:
                 readline.set_completer(new_completer)
             else:
-                # IPython hacks readline such that `readline.set_completer`
+                # Try both initializations to cope with all IPython versions.
+                # This works fine for IPython 3.x but not for earlier:
+                readline.set_completer(new_completer)
+                # IPython<3 hacks readline such that `readline.set_completer`
                 # won't work.  This workaround injects the new completer
-                # function into the existing instance directly.
+                # function into the existing instance directly:
                 instance = getattr(completer, 'im_self', completer.__self__)
                 instance.rlcomplete = new_completer
         if readline.__doc__ and 'libedit' in readline.__doc__:
@@ -3304,7 +3307,7 @@ completion."
                 ;; output end marker is found.  Output is accepted
                 ;; *very* quickly to keep the shell super-responsive.
                 (while (and (not (re-search-backward 
"~~~~__dummy_completion__" nil t))
-                            (< (- current-time (float-time))
+                            (< (- (float-time) current-time)
                                python-shell-completion-native-output-timeout))
                   (accept-process-output process 0.01))
                 (cl-remove-duplicates



reply via email to

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