This reverts commit 5d522b430b. The change led to M-x not working in non-gui Emacsen (bug#51253).
5d522b430b