Function: hexlify-buffer
hexlify-buffer is an autoloaded, interactive and byte-compiled
function defined in hexl.el.gz.
Signature
(hexlify-buffer)
Documentation
Convert a binary buffer to hexl format.
This discards the buffer's undo information.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/hexl.el.gz
;;;###autoload
(defun hexlify-buffer ()
"Convert a binary buffer to hexl format.
This discards the buffer's undo information."
(interactive)
(and (consp buffer-undo-list)
(or (y-or-n-p "Converting to hexl format discards undo info; ok? ")
(error "Aborted"))
(setq buffer-undo-list nil))
;; Don't decode text in the ASCII part of `hexl' program output.
(let ((coding-system-for-read 'raw-text)
(coding-system-for-write buffer-file-coding-system)
(buffer-undo-list t))
(apply 'call-process-region (point-min) (point-max)
(expand-file-name hexl-program exec-directory)
t t nil
;; Manually encode the args, otherwise they're encoded using
;; coding-system-for-write (i.e. buffer-file-coding-system) which
;; may not be what we want (e.g. utf-16 on a non-utf-16 system).
(mapcar (lambda (s)
(if (not (multibyte-string-p s)) s
(encode-coding-string s locale-coding-system)))
(split-string (hexl-options))))
(if (> (point) (hexl-address-to-marker hexl-max-address))
(hexl-goto-address hexl-max-address))))