Subject: bug#13236: 24.3.50; insert-char case-insensitivity damaged by completion customizations

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 16 Aug 2019 00:18:56 -0700

Carsten Bormann <[email-masked]> writes:

> insert-char prompts for a Unicode character name.
>
> As those are typically all upper case, and the user is likely to enter
> lower case input, the completion needs to be case-insensitive.
>
> This works as long as there is no customization of the completion.
> E.g., 
> M-x insert-char RET gree TAB
> shows a number of greek characters, and a number of characters whose
> names start with "GREEN": GREEN APPLE, GREEN BOOK, GREEN HEART.
>
> 1) For
>
> (setq completion-styles '(partial-completion initials))
>
> M-x insert-char RET gree TAB
> leads to:
>
> completion--some: Internal error: GREEN BOOK doesn't match \`gree

(I'm going through old bug reports that have unfortunately gotten no
responses yet.)

I tried reproducing this in Emacs 27, and I didn't get that error
message -- instead TAB seemed to complete as normal.

Are you still seeing this error in modern Emacsen?

> 2) For
>
> (setq completion-pcm-complete-word-inserts-delimiters t)
>
> M-x insert-char RET SPC ellipsis TAB
>
> (note the SPC) at the prompt doesn't provide a match, while
>
> M-x insert-char RET SPC ELLIPSIS TAB
>
> shows several character names that contain the word ELLIPSIS.

Ditto with this case -- I get lots of ELLIPSIS completions with "
ellipsis".

> I didn't try this exhaustively, but it seems there are several
> interactions the current code does not consider.
>
> Patching read-char-by-name like this seems to make work the cases 
> I'm interested in:
>
>    (let* ((enable-recursive-minibuffers t)
>  	 (input
> +          (let ((completion-ignore-case t)) ; HACK
>  	  (completing-read

Looks like pretty much this was done in 2013 -- the code now reads:

  (let* ((enable-recursive-minibuffers t)
	 (completion-ignore-case t)
	 (input

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