Subject: Re: bug#28051: Multiline Statement Indentation Error in Inferior Python Mode

From: [email-masked]
Date: Mon, 21 Aug 2017 21:36:20 -0400

[email-masked] writes:

>> I can reproduce this on Windows.  And on GNU/Linux after doing (setq
>> python-shell-completion-native-enable nil).  Perhaps this is one of the
>> "limitations" referred to in the comments of python.el:
>>
>>     ;; ...the "fallback" or "legacy" mechanism works by executing Python
>>     ;; code in the background and enables auto-completion for shells
>>     ;; that do not support receiving escape sequences (with some
>>     ;; limitations, i.e. completion in blocks does not work).
>
> I think the best we can do is disable completion with an error message
> when the prompt is "..."

> @@ -3632,7 +3639,9 @@ python-shell-completion-at-point
>                         ;; Also, since pdb interaction is single-line
>                         ;; based, this is enough.
>                         (string-match-p python-shell-prompt-pdb-regexp prompt))
> -                   #'python-shell-completion-get-completions)
> +                   (if (equal python-shell--block-prompt prompt)
> +                       (user-error "Cannot use standard completion in multiline statement")
> +                     #'python-shell-completion-get-completions))
>                    (t #'python-shell-completion-native-get-completions)))))

Hmm, when using company-mode the error message is sent repeatedly, which
seems pretty annoying.  But silently returning no matches could be
confusing.  Dimitri, any advice?