Subject: RE: bug#19474: 24.4; icomplete fails to insert character with C-x 8

From: Drew Adams <[email-masked]>
Date: Tue, 12 Jan 2016 21:39:26 -0800 (PST)

> It seems to me that the issue here is that icomplete expects one
> to accept completions via C-j (`minibuffer-force-complete-and-exit`)
> rather than RET (which is bound to `minibuffer-exit`).

Yes, exactly.

> i myself find this behaviour
> counterintuitive, and would prefer that RET also be bound to
> `minibuffer-force-complete-and-exit`, since i would still be able
> to exit the minibuffer via C-g. i wonder if there are people
> relying on RET being bound to `minibuffer-exit`?

Yes, there are.  Icomplete's C-j does not have the same
behavior as RET.  If Icomplete treated RET the way it
treats C-j then that would mean that you could never input
anything that matched a completion candidate, without
choosing that match.

IOW, it would remove the possibility of lax completion.

You could not, for example, use `C-x b' to create a new
buffer `foo' if there were already a buffer `foobar' -
typing `foo RET' would just choose `foobar'.

IOW, even in Icomplete mode, RET is used normally in the
minibuffer: it accepts the text typed so far or, if a
match is required in order to exit and there is only one
possible match, it accepts that match.

C-j for Icomplete mode is used not to input what you have
typed so far but to input the first of the available matches.
IOW, it completes and then exits (similar to what
`minibuffer-complete-and-exit' does).

Completion for `C-x 8 RET' is lax - a match is not required.

This is because you can enter something other than a match
of one of the char names - you can enter a code point.
E.g., you can type `1F4A9 RET' to get your pile of poo.

The code point here is not a _match_ for the char name
(and only char names are completion candidates - there is
no _completion_ against code points).  The code point is
simply another acceptable input, and it has the same effect
(inserts the same char).

---

FWIW, if you were to do this in Icicles, with the default
settings, you _could_ use RET, for this reason:

With the default settings your input for `C-x 8 RET' can
match any combination of parts of a 3-part multi-completion:
char name, code point, and the char itself.  (You can
complete the name or the code point, or both.  And you can
alternatively type the code point or the char to see what
the name is.)

And with the default settings, if your input matches only
a char name or a code point, and if there is only one match,
then that char is inserted.  (Again, you can complete
against the name, the code point, or the char itself, or
any combination of these parts.)

(If option `icicle-read-char-by-name-multi-completion-flag'
is nil, which is not the default value, then the behavior
is similar to vanilla Emacs,except that you get Icicles
matching against the char name.)