1

There is hexl-forward-char which lets me move forward/backward specifying a decimal offset.

And there is also hexl-goto-hex-address to specify an absolute location using a hexadecimal number.

Is there perhaps also something builtin that lets me move by an hexadecimal offset, or do I need to roll my own here?

  • I'm not seeing any other movement commands calling `hexl-hex-string-to-integer`, so I think you'll have to roll your own. – phils Nov 06 '18 at 22:13

2 Answers2

2

Here's my own function. It seems to do the trick.

(defun hexl-hex-forward-char (hex-offset)
  "Move to right HEX-OFFSET bytes (left if negative) in Hexl mode."
  (interactive "sHex Offset: ")
  (hexl-goto-address
    (+ (hexl-current-address)
    (hexl-hex-string-to-integer hex-offset))))

And the following overwrites the key binding for hexl-forward-word which I don't use:

(add-hook 'hexl-mode-hook
          (lambda () (local-set-key (kbd "M-f") #'hexl-hex-forward-char)))
1

The upcoming nhexl-mode-1.0 (in GNU ELPA) changes C-u so it takes hexadecimal input. IOW C-u 10 C-f will advance by 16 chars instead of 10.

Stefan
  • 26,154
  • 3
  • 46
  • 84