Function: printify-region
printify-region is an interactive and byte-compiled function defined
in lpr.el.gz.
Signature
(printify-region BEGIN END)
Documentation
Replace nonprinting characters in region with printable representations.
The printable representations use ^ (for ASCII control characters) or hex. The characters tab, linefeed, space, return and formfeed are not affected.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/lpr.el.gz
(defun printify-region (begin end)
"Replace nonprinting characters in region with printable representations.
The printable representations use ^ (for ASCII control characters) or hex.
The characters tab, linefeed, space, return and formfeed are not affected."
(interactive "r")
(save-excursion
(save-restriction
(narrow-to-region begin end)
(goto-char (point-min))
(let (c)
(while (re-search-forward "[\^@-\^h\^k\^n-\^_\177-\377]" nil t)
(setq c (preceding-char))
(delete-char -1)
(insert (if (< c ?\s)
(format "\\^%c" (+ c ?@))
(format "\\%02x" c))))))))