79

GitHub - AdamNiederer/0xc: Easy base conversion in emacs

 5 years ago
source link: https://github.com/AdamNiederer/0xc
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

GPLv3 MELPA Build Status Coverage

0xc

(Pronounced "hex convert")

Base conversion made easy in emacs

Features

  • Base conversion!
  • Intelligent base inference
  • Replace-at-point methods
  • Simple representation of bases up to 36

Installation & Setup

0xc is avilable on Melpa. After installing with M-x package-install <RET> 0xc <RET>, all functions should be available.

Functions

  • 0xc-convert - Simple string-to-string base conversion. Accepts prefix options and allows interactive use.
  • 0xc-convert-point - Replace the number at point with a converted representation.

Base Hinting

A number literal's base can be roughly determined via heuristics, but you can use the following hints to ensure 0xc gets it right:

  • 0x is a hexadecimal literal
  • 0b is a binary literal
  • 0t is a ternary literal
  • 0d is a decimal literal
  • 0o is an octal literal

Alternatively, you can prefix a base-n number with n:. 0xc will automatically remove any of these base hints when converting

Future

More tests are next. If you feel like beating me to it, open a pull request.

License

GPLv3+


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK