Mercurial > emacs
changeset 101102:e65de16571ff
(mail-quote-printable-region): New function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 10 Jan 2009 23:18:08 +0000 |
parents | 86ea76dd60c9 |
children | 2caa616e6eac |
files | lisp/mail/mail-utils.el |
diffstat | 1 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/mail/mail-utils.el Sat Jan 10 23:17:44 2009 +0000 +++ b/lisp/mail/mail-utils.el Sat Jan 10 23:18:08 2009 +0000 @@ -77,6 +77,26 @@ "?=") (concat result (substring string i)))))) +;;;###autoload +(defun mail-quote-printable-region (beg end &optional wrapper) + "Convert the region to the \"quoted printable\" Q encoding. +If the optional argument WRAPPER is non-nil, +we add the wrapper characters =?ISO-8859-1?Q?....?=." + (interactive "r\nP") + (save-match-data + (save-excursion + (goto-char beg) + (save-restriction + (narrow-to-region beg end) + (while (re-search-forward "[?=\"\200-\377]" nil t) + (replace-match (upcase (format "=%02x" (preceding-char))) + t t)) + (when wrapper + (goto-char beg) + (insert "=?ISO-8859-1?Q?") + (goto-char end) + (insert "?=")))))) + (defun mail-unquote-printable-hexdigit (char) (setq char (upcase char)) (if (>= char ?A)