Subject: bug#47699: [PATCH] Improve completion-list-mode-map

From: Gregory Heytings <[email-masked]>
Date: Sun, 11 Apr 2021 10:50:15 +0000

>> If you agreed with it, I would be pleased to add symmetry there.  I use 
>> M-c for both purposes locally:
>>
>> (define-key minibuffer-local-map (kbd "M-c") 'switch-to-completions)
>> (define-key completion-list-mode-map (kbd "M-c") 'other-window)
>
> I don't think other-window is the right command, because with some 
> window configurations it might land you in the wrong window.  It has to 
> be a command that lands you back in the mini-window.
>

In practice other-window works well there, but now that you mention it, I 
agree with you that it's not safe enough.  What about:

(defun switch-to-minibuffer ()
   "Select the minibuffer window."
   (interactive)
   (when (active-minibuffer-window)
     (select-window (active-minibuffer-window))))