Subject: Re: bug#68559: [PATCH] Improve Python shell completion

From: kobarity <[email-masked]>
Date: Mon, 29 Jan 2024 22:15:20 +0900

kobarity wrote:
> Liu Hui wrote:
> > Thanks for pointing it out. The attached patch should now restore
> > previous basic completion behavior in comments.
> 
> Thanks, I confirmed that basic completion (without keyword argument
> completion) can be performed within comments.

One additional comment regarding ERT.  pyenv installs an ipython shim
to the shims directory, if there is at least one virtualenv providing
ipython.  It can be found by `executable-find'.  However, it is not
usable unless the virtualenv is activated.  As a result, the
`python-shell-completion-at-point-ipython' ERT would fail unless a
virtualenv which provides ipython is activated.

This may be something pyenv users should take care of, but it is more
convenient for pyenv users like me to make the following changes.

diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index ae23ff8ebe2..9452f136cfb 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -4854,7 +4854,10 @@ python-shell-completion-at-point-ipython
   "Check if Python shell completion works for IPython."
   (let ((python-shell-interpreter "ipython")
         (python-shell-interpreter-args "-i --simple-prompt"))
-    (skip-unless (executable-find python-shell-interpreter))
+    (skip-unless
+     (and
+      (executable-find python-shell-interpreter)
+      (eql (call-process python-shell-interpreter nil nil nil "--version") 0)))
     (python-tests-with-temp-buffer-with-shell
      ""
      (python-shell-with-shell-buffer