Skip to content

An Elisp module for adding data inspection capabilities to hexl-mode

License

Notifications You must be signed in to change notification settings

Remillard/hexl-inspect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

hexl-inspect.el

hexl-inspect

This package implements a minor mode named hexl-inspect-mode to be used in conjunction with a buffer set to hexl-mode. When activated, the minor mode will create a data inspection buffer, window, and display to the side of the hexl-mode buffer. As the point moves around in the parent buffer, the contents will update to reflect the point’s position.

The mode depends on the variable state of hexl-inspect--big-endian-p which determines how the data under the point is to be interpreted.

The automated update structure and the mode structure was patterned after the explore mode in treesit-explore-mode in treesit.el as that was the closest analog to what I was attempting to accomplish.

Installation

MELPA

This package is not yet available at MELPA.

Manual

  1. Clone the repository to a location of your choice. The examples provided will assume ~/.emacs.d/site-lisp/hexl-inspect.
  2. Load the package as part of initialization, such as:
(use-package hexl-inspect
  :load-path "~/.emacs.d/site-lisp/hexl-inspect")

Usage

Activation

It may be useful to add a keybind to hexl-mode to activate the data inspection.

(add-hook 'hexl-mode-hook
          (lambda () (define-key hexl-mode-map (kbd "C-c i") 'hexl-inspect-mode)))

Keybinds

KeybindFunction
C-c hToggles the endianness of the data inspection.

Using hexl-inspect

It should be as easy as activating the mode and moving the point around. A buffer will appear alongside the hexl-mode buffer with the following contents (as a sample). The endian mode will change when toggled via C-c h.

-------------------- Data Inspection -------------------
--------------------  Little endian  -------------------
Byte (Hex):           0x48
Byte (Binary):        0b01001000
uint8:                72
int8:                 72
char:                 H

16-bit word (Hex):    0x4348
16-bit word (Binary): 0b0100001101001000
uint16:               17224
int16:                17224
chars:                CH

32-bit word (Hex):    0x43594348
32-bit word (Binary): 0b01000011010110010100001101001000
uint32:               1129923400
int32:                1129923400


64-bit word (Hex):    0x000f424143594348
uint64:               4294972720890696
int64:                4294972720890696
--------------------------------------------------------

Change Log

VersionDescription
0.1-preInitial release with various clean up.

Development

To Do List [2/5]

At the moment, this suits my needs fairly well. I suspect before it’s released for general consumption some additional safety measures may need to be added. It’s also not wildly aesthetically appealing so that might be something to think about. I welcome suggestions on how to improve the module.

Current things to address:

  • [X] Does not compile cleanly. Investigate compilation and address warnings/errors
  • [ ] Implement more customizable parameters (timer, output products, etc.)
  • [ ] Create keybind to bring the buffer back after a user hits q.
  • [ ] Possibly create a keybind for dismissing the buffer like q because the point is actually in the parent buffer for operations.
  • [X] Detect when the point was placed on the second nibble of an address and account for that when performing the character acquisition (foolproofing)

License

GPLv3

About

An Elisp module for adding data inspection capabilities to hexl-mode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published