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?

1
  • 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 6, 2018 at 22:13

2 Answers 2

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.

2
  • It works! Where can I report nhexl-mode bugs? Nov 9, 2018 at 16:55
  • You can send them directly to me or M-x report-emacs-bug.
    – Stefan
    Nov 9, 2018 at 17:06
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)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.