Elisp: Character Type
In emacs lisp, character is represented as integer of the character's Unicode code point.
For example, the char a in elisp is just 97, because its code point is 97.
Note: elisp “Character Type” is not technically a “type” of value in the sense of most programing languages, because there's no way to distinguish integer from char. There is no function that returns true/false on whether a value is a character type. (by comparison, there are
symbolp, etc.) Whether a integer is a character depends on where it is used.
Char can also be represented like this
?a for easy reading.
?a means the character a.
You can also represent char by
(equal 97 ?a ) ;; t (equal 97 (string-to-char "a")) ;; t
Find a Char's Code Point
To find a char's code point, Alt+x
ASCII Control Chars and Backslash
Syntax of the form
May have special meaning, depending what char is.
?\n is the newline char.
?\\ is backslash char.
They either represent a ASCII control character, or just the character char.
Here's a list of special meaning with the backslash:
?\a→ 7 ; control-g, C-g
?\b→ 8 ; backspace, BS, C-h
?\t→ 9 ; tab, TAB, C-i
?\n→ 10 ; newline, C-j
?\v→ 11 ; vertical tab, C-k
?\f→ 12 ; formfeed character, C-l
?\r→ 13 ; carriage return, RET, C-m
?\e→ 27 ; escape character, ESC, C-[
?\s→ 32 ; space character, SPC
?\\→ 92 ; backslash character, \
?\d→ 127 ; delete character, DEL
[see ASCII Table]