12

I just discovered C-x 8 RET as a way to insert Unicode characters by Unicode name or hex code. I have not (yet?) memorised all Unicode character names, so I don't always find the right character.

There is, for example, the character "SNOW CAPPED MOUNTAIN". If I type just "MOUNTAIN" this character will not appear the completion list. I need to remember to search for "SNOW" to see this particular character in the list of completions.

As someone who has become dependent on IDO for anything involving completion, this lack of flexibility is rather unnerving. I use ido-ubiquitous-mode.

How can I use IDO-like matching for Unicode input? How can I use flexible completion for ALL THE THINGS?

(I would be okay with abandoning IDO mode if there was something better.)

  • As a workaround for that same problem, I would type C-q SPC mountain TAB. That would match any character name with "mountain" as non-first word. – legoscia Nov 5 '14 at 14:52
  • 1
    Have a look at emacs.stackexchange.com/a/3139/2094 for helm-based completion. – abo-abo Nov 5 '14 at 14:54
  • 1
    Hmm, this sounds like a bug you can report at the project's issue tracker. – wasamasa Nov 5 '14 at 15:12
  • 1
    If you type *cap*mou TAB, then you get the whole completion(s). – Juancho Nov 5 '14 at 16:00
  • @Juancho that's true, but it's not the behaviour I want – rekado Nov 5 '14 at 16:10
8

As @wasamasa suggested, ido-ubiquitous should take care of completion when insert-char is used. There is a bug report that was closed in 2013, but I still see this behaviour with Emacs 24.4 and ido-ubiquitous version 20140904.1547, so I filed another bug report.

EDIT:

The maintainer of ido-ubiquitous wrote this:

Ok, I figured out the problem. There are a lot of unicode characters, so the list of completions is exceeding ido-ubiquitous-max-items and ido-ubiquitous is disabling itself for that reason. On my system, there are almost 40k completions available, and the default for ido-ubiquitous-max-items is 30k. Setting it to 50k enables ido completion for insert-char for me. So try customizing that.

Indeed, (setq ido-ubiquitous-max-items 50000) fixes it.

  • For ido-completing-read+, use (setq ido-cr+-max-items 50000) to fix this error. – Bach Lien Feb 6 '18 at 8:45
5

To get snow capped mountain included when you just type mount, you may want to do:

(push '(unicode-name (styles substring)) completion-category-overrides)

Actually, maybe this substring style should be enabled by default for unicode names, like it is for buffer names. Maybe you should lobby for it via M-x report-emacs-bug.

3

If you use Icicles then C-x 8 RET lets you use substring or regexp or fuzzy matching during completion. And you can use progressive completion, to match against multiple (e.g. simple) patterns.

In addition, if option icicle-read-char-by-name-multi-completion-flag is non-nil, which it is by default, then you can use multi-completion to match against any combination of these:

  • the Unicode name
  • the Unicode code point, as a hexidecimal numeral
  • the character itself (as it appears in text, not an integer)

Completion candidates you see in buffer *Completions* contain all of these components - WYSIWYG.

Why might you want to match against the character itself? To see the corresponding Unicode code points and character name(s), including any old names. For example, for the character ` (grave accent) you get these two completion candidates:

GRAVE ACCENT      60      `
SPACING GRAVE     60      `
  • I think I should really try Icicles one day. Thanks for your answer. – rekado Nov 6 '14 at 9:26
0

You can use command apropos-char in library apu.el to show all of the Unicode chars whose names match a regexp or list of words you type. By default, words are matched as substrings.

In the list of matches, you can hit ^ to insert the char shown on the current line into the buffer where you invoked apropos-char, at point. Or you can hit C-y to copy that char to the kill ring (or M-y to copy it to the secondary selection). (Hit RET to see more info about the char.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.