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?

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)
|improve this answer|||||
  • 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 Oct 25 '18 at 11:53
  • Yes, within emacs, and within most, if not all, consoles as well. – Lindydancer Oct 25 '18 at 11:55
  • 1
    For more information see M-: (info "(elisp) Basic Char Syntax") – izkon Oct 25 '18 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). – Radon Rosborough 2 days ago

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.