emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp/mail mail-utils.el


From: Richard M. Stallman
Subject: [Emacs-diffs] emacs/lisp/mail mail-utils.el
Date: Sat, 10 Jan 2009 23:18:08 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       09/01/10 23:18:08

Modified files:
        lisp/mail      : mail-utils.el 

Log message:
        (mail-quote-printable-region): New function.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mail/mail-utils.el?cvsroot=emacs&r1=1.67&r2=1.68

Patches:
Index: mail-utils.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mail/mail-utils.el,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- mail-utils.el       5 Jan 2009 03:22:32 -0000       1.67
+++ mail-utils.el       10 Jan 2009 23:18:08 -0000      1.68
@@ -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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]