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?

Drew
  • 75,699
  • 9
  • 109
  • 225
Andrew L
  • 23
  • 2

1 Answers1

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)
Lindydancer
  • 6,095
  • 1
  • 13
  • 25
  • 1
    Ah, right. So the [ASCII character](http://www.asciitable.com) 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). – Resigned June 2023 Apr 07 '20 at 16:52