Subject: Re: bug#63552: 29.0.91; M-x completion-predicate does not account for python-ts-mode

From: Eli Zaretskii <[email-masked]>
Date: Wed, 17 May 2023 15:40:03 +0300

> Cc: Augusto Stoffel <[email-masked]>
> Date: Wed, 17 May 2023 12:54:56 +0100
> From:  Basil Contovounesios via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> At the time of https://bugs.gnu.org/57184 python-ts-mode did not yet
> exist, so the completion-predicates added to python.el as part of that
> report understandably assumed only python-mode exists.
> 
> Here's what that means in practice:
> 
> 0. emacs -Q
> 1. (setq read-extended-command-predicate
>          #'command-completion-default-include-p)
> 2. C-x C-e
> 3. M-x python-ts-mode RET
> 4. M-x python-sort TAB
>    => [No match]
> 
> And yet python-sort-imports is present in the local map:
> 
> 5. C-g
> 6. C-h f python-sort-imports RET
>    => It is bound to C-c TAB s.
> 
> By contrast, in python-mode:
> 
> 7. M-x python-mode RET
> 8. M-x python-sort TAB
>    => Completes to python-sort-imports
> 
> The following patch fixes this by associating M-x completion with
> python-base-mode rather than python-mode:

Thanks.

We need to fix tis on the emacs-29 branch, so I wonder whether the fix
can be simpler?  After all, we just need to test one more major mode,
right?

If a simpler fix is less clean, we could install a simpler change on
emacs-29 and a cleaner one on master.