How to display numbers in different bases under elisp?
As we know, elisp supports number in different bases, e.g. #20r1j equals to 39 in base-10. I want to display #20r1j as #20r1j . But (format "%d" #20r1j) gives me 39 . How to keep the number in its original base? As a format string, you are quite limited in the bases you can display: %d means print as number in decimal (%o octal, %x hex). %X is like %x, but uses upper case. You can use the calc library to manage this for you, however: (require 'calc-bin) (let ((calc-number-radix 20)) (math-format-radix 39)) "1J" (let ((calc-number-radix 20)) (math-format-radix #20r1j)) "1J" As with the read