1

I'm using C-x 8 RET to insert a Unicode character. I enter the hex value -- for example, 201c -- and the minibuffer says "no matches". But if I just hit enter, the expected left double quote character “ gets inserted.

OTOH, if I type "left quot" or similar, the completion narrows the choices as expected, and I can use tab to complete LEFT DOUBLE QUOTATION MARK as expected.

I'm seeing similar behavior even when I start emacs with "-Q": there, I type "201c", hit tab -- it says no match, but if I hit enter, it inserts the character.

Why is the completion saying there's no matches, but hitting enter successfully finds the character?

Drew
  • 75,699
  • 9
  • 109
  • 225
Dan Drake
  • 503
  • 2
  • 15

1 Answers1

1

You see No match when you hit TAB because there's no match for the text 201c using the completion-styles you have.

More importantly, C-x 8 RET matches character names, not code points. But if you hit RET to enter a code point, then its char is inserted.

See the doc of function insert-char (which is bound to C-x 8 RET). It says:

You can specify CHARACTER in one of these ways:

  • As its Unicode character name, e.g. "LATIN SMALL LETTER A". Completion is available; if you type a substring of the name preceded by an asterisk *, Emacs shows all names which include that substring, not necessarily at the beginning of the name.

  • As a hexadecimal code point, e.g. 263A. Note that code points in Emacs are equivalent to Unicode up to 10FFFF (which is the limit of the Unicode code space).

  • As a code point with a radix specified with #, e.g. #o21430 (octal), #x2318 (hex), or #10r8984 (decimal).

Drew
  • 75,699
  • 9
  • 109
  • 225
  • Hrm, it seems you're right. But it's very unintuitive: the completion for me shows the hex code point too, so I expected the completion to look at that. But I guess if the completion really is just looking at the names, then saying there's no match is technically correct... – Dan Drake Mar 02 '23 at 20:27
  • 1
    If you see the code points also but there's no completion against them then they are likely shown only as *annotations*. (There's no completion against annotations.) – Drew Mar 03 '23 at 04:49