diff options
author | Eric S. Raymond <esr@snark.thyrsus.com> | 1993-03-27 01:58:38 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@snark.thyrsus.com> | 1993-03-27 01:58:38 +0000 |
commit | 1c2df06340453138e48857c93e6eee1842833c14 (patch) | |
tree | d7c445a3ffd51ea8ac91834bb5e92f394f656ec0 /lisp/lpr.el | |
parent | 45b44a5a6543d27c775db764a70cd55ba0496e2d (diff) | |
download | emacs-1c2df06340453138e48857c93e6eee1842833c14.tar.gz |
(printify-buffer) Added, debugged from Roland McGrath's printify-buffer code
in LCD.
Diffstat (limited to 'lisp/lpr.el')
-rw-r--r-- | lisp/lpr.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/lpr.el b/lisp/lpr.el index 2beead551ec..3bd12335068 100644 --- a/lisp/lpr.el +++ b/lisp/lpr.el @@ -108,4 +108,20 @@ See definition of `print-region-1' for calling conventions.") (insert-buffer-substring oldbuf start end) (setq start (point-min) end (point-max))))) +(defun printify-region (begin end) + "Turn nonprinting characters (other than TAB, LF, SPC, RET, and FF) +in the current buffer into printable representations as control or +hexadecimal escapes." + (interactive "r") + (save-excursion + (goto-char begin) + (let (c) + (while (re-search-forward "[\^@-\^h\^k\^n-\^_\177-\377]" end t) + (setq c (preceding-char)) + (delete-backward-char 1) + (insert + (if (< c ?\ ) + (format "\\^%c" (+ c ?@)) + (format "\\%02x" c))))))) + ;;; lpr.el ends here |