I'm looking for an Emacs package that can recognise numbers and their radix.
I would like it to be interactive (to give the value of the number selected or at point).
The returned values could be printed to the minibuffer (then messages buffer) or to a separate buffer.
Can someone explain how can I get access those values and what are the steps I need to take to create such a function?
I don't have a full, direct answer for you, but here are a couple of libraries that you can look at for ideas about realizing this yourself. Some of the question depends on just how you want to display/return the number.
modeline-char.el- Minor modemlc-char-in-mode-line-modeshows the char after point in a mode-line lighter, followed by=, followed by the hex Unicode code point for the char. See Show Char In Mode Line.thingatpt+.el- Functions such asnumber-at-point-decimalandnumber-at-point-hex. See Thing At Point Plus.If the text to recognize uses the standard Emacs form for radix and number in that radix then you can define a
radix-number-at-point. That form is documented in the Elisp manual, node Integer Basics. For example,#13r90B3is the same number as decimal integer19919.Here'a a quick definition. You might want to tweak it.
You can also define a function that doesn't require the explicit
#rRADIXpart, for example automatically trying different radixes, in sequence and, say, using the lowest radix that returns a number.