Subject: bug#36454: 26.2.90; feature request - Insert char by hex tab completion or C-x 8 RET ffe <TAB>

From: Drew Adams <[email-masked]>
Date: Mon, 15 Jul 2019 09:03:22 -0700 (PDT)

> Not that I disagree, but I have this idea.  There are 3 ways of
> specifying character for 'C-x 8 RET':
> 1. Unicode name,
> 2. hex code,
> 3. code with radix specified, e.g. #o... (octal), #x... (hex),
>     #10r...(decimal).
> 
> While it'll be difficult(?) to have both completions for name and hex
> code (point 1. and 2.), because for example some names include
> numbers, completions based on the code for 3rd method of inserting
> char could be added.  This way if someone type letters or numbers -
> method 1. or 2. - he'll get completions based on Unicode name.  BUT if
> he define radix in the beginning (#b/#o/#x/#RADIXr), possible
> completions based on the code will appear.  A bit more typing
> (defining radix) but it could work.  This way we could also get
> completions for other codes than hex.
> 
> > I don't think this sounds very useful, because the hex values are
> > kinda tightly packed, so you get too many matches.
> 
> With approach described above, it'll only happen with 3rd method -
> probably not the most popular.  Also I think if someone will try to
> complete it, he'll do it after typing at least 2 or as OP - 3 letters.
> 
> > And they get in the way of name completion.

There's no problem with allowing completion
against both char names and hex code points.
Haven't seen any problem at all.  (But of
course you'll want to use a substring
completion style.)

---

FWIW - For Emacs 23-25, Icicles supports
your #1 and #2.

[And it supports a 4th kind of completion:
You can enter a Unicode char itself (e.g.
paste it into the minibuffer, or type a
key binding that inserts it), and you see
both its Unicode name and its code point.

IOW, you can use completion to get info
about a char, not just insert a char.]

---

In Emacs 26 they changed to using a hash
table for `ucs-names', which is more
unidirectional than an alist, and I haven't
bothered to try to convert the code.

Maybe I'll fiddle with trying to get
something reasonable using the hash table;
maybe not.

(By "more unidirectional" I mean you can't
easily look up a key, given its value.
I say "more" because maybe you can do it
using `maphash', at quite a cost.  And of
course I could convert the `ucs-names'
hash table to an alist, at high cost.)