diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 0b4a773516a..ad0e84bf74f 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -3652,14 +3652,18 @@ eventually provide a shell." | |||
| 3652 | 3652 | ||
| 3653 | (defconst python-shell-setup-code | 3653 | (defconst python-shell-setup-code |
| 3654 | "\ | 3654 | "\ |
| 3655 | try: | 3655 | def _PYTHON_EL_setup(): |
| 3656 | import termios | 3656 | try: |
| 3657 | except ImportError: | 3657 | import termios |
| 3658 | pass | 3658 | except ImportError: |
| 3659 | else: | 3659 | pass |
| 3660 | attr = termios.tcgetattr(0) | 3660 | else: |
| 3661 | attr[3] &= ~termios.ECHO | 3661 | attr = termios.tcgetattr(0) |
| 3662 | termios.tcsetattr(0, termios.TCSADRAIN, attr)" | 3662 | attr[3] &= ~termios.ECHO |
| 3663 | termios.tcsetattr(0, termios.TCSADRAIN, attr) | ||
| 3664 | |||
| 3665 | _PYTHON_EL_setup() | ||
| 3666 | del _PYTHON_EL_setup" | ||
| 3663 | "Code used to setup the inferior Python processes.") | 3667 | "Code used to setup the inferior Python processes.") |
| 3664 | 3668 | ||
| 3665 | (defconst python-shell-eval-setup-code | 3669 | (defconst python-shell-eval-setup-code |
| @@ -4639,11 +4643,15 @@ shell has no readline support.") | |||
| 4639 | "Detect the readline support for Python shell completion." | 4643 | "Detect the readline support for Python shell completion." |
| 4640 | (let* ((process (python-shell-get-process)) | 4644 | (let* ((process (python-shell-get-process)) |
| 4641 | (output (python-shell-send-string-no-output " | 4645 | (output (python-shell-send-string-no-output " |
| 4642 | try: | 4646 | def _PYTHON_EL_detect_readline(): |
| 4643 | import readline | 4647 | try: |
| 4644 | print(readline.get_completer_delims()) | 4648 | import readline |
| 4645 | except: | 4649 | print(readline.get_completer_delims()) |
| 4646 | print('No readline support')" process))) | 4650 | except: |
| 4651 | print('No readline support') | ||
| 4652 | |||
| 4653 | _PYTHON_EL_detect_readline() | ||
| 4654 | del _PYTHON_EL_detect_readline" process))) | ||
| 4647 | (setq-local python-shell-readline-completer-delims | 4655 | (setq-local python-shell-readline-completer-delims |
| 4648 | (unless (string-search "No readline support" output) | 4656 | (unless (string-search "No readline support" output) |
| 4649 | (string-trim-right output))))) | 4657 | (string-trim-right output))))) |