Subject: bug#50228: [PATCH] 'command-completion-using-modes-p' doesn't work with multiple modes

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 27 Aug 2021 17:31:41 +0200

Johannes Maier <[email-masked]> writes:

> I've attached a patch that removes the duplicated checks in these two
> functions and simply calls 'command-completion-with-modes-p' from
> 'command-completion-using-modes-p'.  Now it works for me with one or
> more (major or minor) modes in 'interactive'.

Thanks, that does fix the problem.

However, the reason `command-completion-using-modes-p' is coded that way
is that `command-completion-with-modes-p' is slower in the common case,
and completion has to be fast.  But in the multiple-mode case, we can
indeed just call `command-completion-with-modes-p', so I've kept the
common case, but punted to `command-completion-with-modes-p' in the
multiple-mode case, and that seems to fix the issue.

> (I didn't see any tests for those functions, but I'm not sure how to go
> about those yet.  Could probably have look into those, too.)

Yes, there really should be tests in this area...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no