AdamNiederer / AdamNiederer/0xc

Mode-sensitive number base cycling?

Aperta
#8 1 commento 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Emacs Lisp
Stelle
44
Fork
8
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I was looking for a command like `M-x number-base-at-point-cycle`. If I'm in `c-mode` and I have `0123` (octal) at point, it would convert it to `83` (decimal). If I then used the command a second time, it would convert the number to `0x53` (hex). A third time, back to `0123` (octal). If I'm in `nasm-mode` it would know that NASM also has `0b1010` syntax for binary literals so it would cycle through that as well. If I used the command in `lisp-mode` it would know that Lisp spells numbers like `#x-123` (hex) and would do the same thing in a mode-sensitive fashion. This command could then be used in keyboard macros to convert many numbers at once. Actually we could have:

* `number-base-at-point-to-binary`
* `number-base-at-point-to-octal`
* `number-base-at-point-to-decimal`
* `number-base-at-point-to-hex`
* `number-base-at-point-cycle`

Each of them could take an optional prefix argument to specify the number of digits in the resulting number, so the result would be padded with leading zeros where needed.

Do you think such a command would be a good fit for this package, or too different?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.