Function: hexl-insert-hex-char

hexl-insert-hex-char is an interactive and byte-compiled function defined in hexl.el.gz.

Signature

(hexl-insert-hex-char ARG)

Documentation

Insert a character given by its hexadecimal code ARG times at point.

Values above 0xFF are treated as multibyte characters, and first encoded using buffer-file-coding-system. Note that if the hexl buffer was produced by hexl-find-file, its coding-system is no-conversion.

Inserting non-ASCII characters requires caution: the buffer's coding-system should correspond to the encoding on disk, and multibyte characters should be inserted with cursor on the first byte of a multibyte sequence whose length is identical to the length of the multibyte sequence to be inserted, otherwise this could produce invalid multibyte sequences. Non-ASCII characters in ISO-2022 encodings should preferably inserted byte by byte, to avoid problems caused by the designation sequences before the actual characters.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/hexl.el.gz
;; hex conversion

(defun hexl-insert-hex-char (arg)
  "Insert a character given by its hexadecimal code ARG times at point.

Values above 0xFF are treated as multibyte characters, and first encoded
using `buffer-file-coding-system'.  Note that if the hexl buffer was
produced by `hexl-find-file', its coding-system is no-conversion.

Inserting non-ASCII characters requires caution: the buffer's
coding-system should correspond to the encoding on disk, and
multibyte characters should be inserted with cursor on the first
byte of a multibyte sequence whose length is identical to the
length of the multibyte sequence to be inserted, otherwise this
could produce invalid multibyte sequences.  Non-ASCII characters
in ISO-2022 encodings should preferably inserted byte by byte, to
avoid problems caused by the designation sequences before the
actual characters."
  (interactive "p")
  (let ((num (hexl-hex-string-to-integer (read-string "Hex number: "))))
    (if (< num 0)
	(error "Hex number out of range")
      (hexl-insert-multibyte-char num arg))))