Subject: bug#42708: Let users copy "*Char Help*" buffer

From: Juri Linkov <[email-masked]>
Date: Tue, 03 Nov 2020 20:57:37 +0200

>>> Oh, I noticed it doesn't support 'C-h' that should pop up the buffer "
>>> *Char Help*" from the dynamic variable 'help-form'.
>>>
>>> Then maybe we should rewrite read-char-choice to use
>>> read-char-from-minibuffer?
>>
>> Yes, that's even better -- then all the callers to read-char-choice
>> would no longer be as modal as they are now.
>
> I've now done this on the trunk.

I tried to reproduce the original test case. i.e. to type 'C'
(dired-do-copy) and select the "*Char Help*" buffer with C-x o.
The result is weird: the cursor in displayed in the minibuffer,
but the selected window is "*Char Help*".  Here's a patch to fix this:

diff --git a/lisp/subr.el b/lisp/subr.el
index 286851dfc8..606ce004d5 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2610,8 +2610,7 @@ read-char-choice
   (unless (consp chars)
     (error "Called `read-char-choice' without valid char choices"))
   (let (char done show-help (helpbuf " *Char Help*"))
-    (let ((cursor-in-echo-area t)
-          (executing-kbd-macro executing-kbd-macro)
+    (let ((executing-kbd-macro executing-kbd-macro)
 	  (esc-flag nil))
       (save-window-excursion	      ; in case we call help-form-show
 	(while (not done)

After looking more at 'read-char-choice', it seems that special handling
of 'inhibit-keyboard-quit' and 'executing-kbd-macro' is not needed
anymore?  And maybe also adding the 'minibuffer-prompt' face is not
needed too.  Then what remains to do in 'read-char-choice' is to call
'read-char-from-minibuffer' and to show 'help-form-show' for 'help-char' key?