diff options
| -rw-r--r-- | 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 fbf944f9c68..0fe1aa97cd0 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -3171,9 +3171,12 @@ def __PYTHON_EL_native_completion_setup(): | |||
| 3171 | if not is_ipython: | 3171 | if not is_ipython: |
| 3172 | readline.set_completer(new_completer) | 3172 | readline.set_completer(new_completer) |
| 3173 | else: | 3173 | else: |
| 3174 | # IPython hacks readline such that `readline.set_completer` | 3174 | # Try both initializations to cope with all IPython versions. |
| 3175 | # This works fine for IPython 3.x but not for earlier: | ||
| 3176 | readline.set_completer(new_completer) | ||
| 3177 | # IPython<3 hacks readline such that `readline.set_completer` | ||
| 3175 | # won't work. This workaround injects the new completer | 3178 | # won't work. This workaround injects the new completer |
| 3176 | # function into the existing instance directly. | 3179 | # function into the existing instance directly: |
| 3177 | instance = getattr(completer, 'im_self', completer.__self__) | 3180 | instance = getattr(completer, 'im_self', completer.__self__) |
| 3178 | instance.rlcomplete = new_completer | 3181 | instance.rlcomplete = new_completer |
| 3179 | if readline.__doc__ and 'libedit' in readline.__doc__: | 3182 | if readline.__doc__ and 'libedit' in readline.__doc__: |
| @@ -3304,7 +3307,7 @@ completion." | |||
| 3304 | ;; output end marker is found. Output is accepted | 3307 | ;; output end marker is found. Output is accepted |
| 3305 | ;; *very* quickly to keep the shell super-responsive. | 3308 | ;; *very* quickly to keep the shell super-responsive. |
| 3306 | (while (and (not (re-search-backward "~~~~__dummy_completion__" nil t)) | 3309 | (while (and (not (re-search-backward "~~~~__dummy_completion__" nil t)) |
| 3307 | (< (- current-time (float-time)) | 3310 | (< (- (float-time) current-time) |
| 3308 | python-shell-completion-native-output-timeout)) | 3311 | python-shell-completion-native-output-timeout)) |
| 3309 | (accept-process-output process 0.01)) | 3312 | (accept-process-output process 0.01)) |
| 3310 | (cl-remove-duplicates | 3313 | (cl-remove-duplicates |