I'm attempting to get the name of the character (or multibyte character) at point, and just the name, programmatically.

describe-char tells me what the character's name is, along with a bunch of other stuff that I don't want.

get-char-property appears to be what I want, except that I tell what property I want. Neither 'name, 'Name, "Name", or "name" seem to do anything (when used as e.g. (get-char-property ?& 'name).


From digging around in the source code for describe-char, get-char-code-property seems to be the right function:

(get-char-code-property ?& 'name)
  • Could you expand a little on how you found it? I dug around in there, but couldn't get much useful.
    – Squidly
    Dec 4 '14 at 15:30
  • I couldn't find anything useful by searching for name, so I searched for the header above the name, Character code properties, and there it was.
    – legoscia
    Dec 4 '14 at 15:43

The accepted answer from @legoscia works only some of the time. It does not work for control characters, including code points between 0 and 32. They don't have a name in the Unicode database. But they do have an old-name.

In Unicode, surrogate code points, private-use characters, control codes, noncharacters, and unassigned code points have no names.

What you want to try in general is this:

(or (get-char-code-property SOME-CHAR 'name)
    (get-char-code-property SOME-CHAR 'old-name))

And keep in mind that some some code points do not even have an old-name.

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.