Subject: Re: bug#24110: [PATCH] Fix python.el completion with IPython 5.0 and python 2

From: [email-masked]
Date: Mon, 03 Jul 2017 11:15:11 -0400

close 24110 
quit

James Porter <[email-masked]> writes:

>  (defcustom python-shell-completion-string-code
> -  "';'.join(__PYTHON_EL_get_completions('''%s'''))"
> +  "print(';'.join(__PYTHON_EL_get_completions('''%s''')))"

This patch is no longer applicable, in 25.1 there is already a 'print'
added by python-shell-completion-get-completions.

    (defun python-shell-completion-get-completions (process import input)
      "Do completion at point using PROCESS for IMPORT or INPUT.
    When IMPORT is non-nil takes precedence over INPUT for
    completion."
      (setq input (or import input))
      (with-current-buffer (process-buffer process)
        (let ((completions
               (python-util-strip-string
                (python-shell-send-string-no-output
                 (format
                  (concat python-shell-completion-setup-code
                          "\nprint (" python-shell-completion-string-code ")")
                  input) process))))
          (when (> (length completions) 2)
            (split-string completions
                          "^'\\|^\"\\|;\\|'$\\|\"$" t)))))