2

I'm getting to grips with Emacs Lisp in GNU Emacs 25.3.2. While trying to understand the printed representation of integers I got confused by the following echo area output produced by C-x C-e:

10
-> 10 (#o12, #xa, ?\C-j)

I gather from the manual section describing the read syntax for integers that #o12 and #xa indicate the octal and hex representations of the decimal number 10 respectively.

What does ?\C-j mean?

1 Answer 1

2

The ?\C-j is the character representation of 10, in this case it's the same as control-j.

For other values, it's more natural, for example 65, which is the ASCII value of A:

65
-> 65 (#o101, #x41, ?A)
4
  • 1
    Ah, right. So the ASCII character corresponding to the decimal number 10 is the LF new line character, and within emacs the key combo to produce that symbol is control-j?
    – Andrew L
    Commented Oct 25, 2018 at 11:53
  • Yes, within emacs, and within most, if not all, consoles as well. Commented Oct 25, 2018 at 11:55
  • 1
    For more information see M-: (info "(elisp) Basic Char Syntax")
    – izkon
    Commented Oct 25, 2018 at 12:20
  • @AndrewL Note that J is the 10th letter of the alphabet. This is not a coincidence; it is used to determine the print representations of all non-printable ASCII characters, and often these are used for keybindings too (control-C is interrupt because the ASCII interrupt character has code 3). Commented Apr 7, 2020 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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