[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Displaying an arbitrary file in _both_ HEX and ASCII



Emacs comes with `hexl-mode` which provides some of that.

The `nhexl-mode` (which you can subsequently install via
`M-x package-list RET`) is an alternative which provides
a few extra features.

> I need to:
>  1. Simultaneously display in _both_ HEX and ASCII format

I'd expect they all do, tho the ASCII part is often much less readable
than when you look at it in a normal editor, because lines are broken at
fixed multiples of bytes rather than at EOL chars.

>  2. Know the current offset in *DECIMAL* format.
>     {knowing the offset also in HEX might be nice}

`hexl-mode` definitely gives you that (via `eldoc-mode` which should be
enabled by default).

`nhexl-mode` doesn't currently (tho `M-: (point) RET` will show you the
decimal offset plus 1, for hysterical raisins).

>  3. Goto to an offset - expressed in DECIMAL.

In hexl-mode, you can do that both in hex or in decimal.

In nhexl-mode `M-g c` will do the decimal, but with the same off-by-one
as `M-: (point) RET`, as for the hexadecimal case it is handled by the
search command (if you search for an hex string it will both look for
positions whose hex representation matches that string and for strings
of bytes whose hex representation matches that string).

I guess I should provide proper nhexl commands for decimal addresses
(to avoid the off-by-one quirk).

>  4. Advance a specific number of bytes.

Yes of course.

>  5. Search for an ASCII string.

In hexl-mode, this kinda works with quirks.
In nhexl-mode, this works just fine, with no particular caveats.

>  6. Search for arbitrary sequence of bytes expressed as HEX.

In hexl-mode, this can kinda work but with a fair bit of gymnastics
and/or caveats.

In nhexl-mode, this works just fine tho it doesn't support regexps (and
don't expect nibble-alignment, i.e. "a5" won't match in "JR" even though
the corresponding hex "4a52" does have the "a5" sequence in it).


        Stefan


Reply to: