Function: hexl-mode


Uses keymap `hexl-mode-map', which is not currently defined.
A mode for editing binary files in hex dump format.
This is not an ordinary major mode; it alters some aspects
of the current mode's behavior, but not all; also, you can exit
Hexl mode and return to the previous mode using `hexl-mode-exit'.

This function automatically converts a buffer into the hexl format
using the function `hexlify-buffer'.

Each line in the buffer has an "address" (displayed in hexadecimal)
representing the offset into the file that the characters on this line
are at and 16 characters from the file (displayed as hexadecimal
values grouped every `hexl-bits' bits) and as their ASCII values.

If any of the characters (displayed as ASCII characters) are
unprintable (control or meta characters) they will be replaced as
periods.

If `hexl-mode' is invoked with an argument the buffer is assumed to be
in hexl format.

A sample format:

HEX ADDR: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ASCII-TEXT
-------- ---- ---- ---- ---- ---- ---- ---- ---- ----------------
00000000: 5468 6973 2069 7320 6865 786c 2d6d 6f64 This is hexl-mod
00000010: 652e 2020 4561 6368 206c 696e 6520 7265 e. Each line re
00000020: 7072 6573 656e 7473 2031 3620 6279 7465 presents 16 byte
00000030: 7320 6173 2068 6578 6164 6563 696d 616c s as hexadecimal
00000040: 2041 5343 4949 0a61 6e64 2070 7269 6e74 ASCII.and print
00000050: 6162 6c65 2041 5343 4949 2063 6861 7261 able ASCII chara
00000060: 6374 6572 732e 2020 416e 7920 636f 6e74 cters. Any cont
00000070: 726f 6c20 6f72 206e 6f6e 2d41 5343 4949 rol or non-ASCII
00000080: 2063 6861 7261 6374 6572 730a 6172 6520 characters.are
00000090: 6469 7370 6c61 7965 6420 6173 2070 6572 displayed as per
000000a0: 696f 6473 2069 6e20 7468 6520 7072 696e iods in the prin
000000b0: 7461 626c 6520 6368 6172 6163 7465 7220 table character
000000c0: 7265 6769 6f6e 2e0a region..

Movement is as simple as movement in a normal Emacs text buffer. Most
cursor movement bindings are the same: use M-x hexl-backward-char, M-x hexl-forward-char, M-x hexl-next-line, and M-x hexl-previous-line
to move the cursor left, right, down, and up.

Advanced cursor movement commands (ala M-x hexl-beginning-of-line, M-x hexl-end-of-line, M-x hexl-beginning-of-buffer, and M-x hexl-end-of-buffer) are
also supported.

There are several ways to change text in hexl mode:

ASCII characters (character between space (0x20) and tilde (0x7E)) are
bound to self-insert so you can simply type the character and it will
insert itself (actually overstrike) into the buffer.

M-x hexl-quoted-insert followed by another keystroke allows you to insert the key even if
it isn't bound to self-insert. An octal number can be supplied in place
of another key to insert the octal number's ASCII representation.

M-x hexl-insert-hex-char will insert a given hexadecimal value (if it is between 0 and 0xFF)
into the buffer at the current point.

M-x hexl-insert-octal-char will insert a given octal value (if it is between 0 and 0377)
into the buffer at the current point.

M-x hexl-insert-decimal-char will insert a given decimal value (if it is between 0 and 255)
into the buffer at the current point.

M-x hexl-mode-exit will exit hexl-mode. Note: saving the file with any of the usual Emacs commands will actually convert it back to binary format while saving. You can use M-x hexl-find-file to visit a file in Hexl mode. C-h b for advanced commands. (fn &optional ARG)