1 |
;;; qp.el --- Quoted-Printable functions |
;;; qp.el --- Quoted-Printable functions |
2 |
|
|
3 |
;; Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. |
;; Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
6 |
;; Keywords: mail, extensions |
;; Keywords: mail, extensions |
66 |
(let ((byte (string-to-int (buffer-substring (1+ (point)) |
(let ((byte (string-to-int (buffer-substring (1+ (point)) |
67 |
(+ 3 (point))) |
(+ 3 (point))) |
68 |
16))) |
16))) |
69 |
(insert byte) |
(mm-insert-byte byte 1) |
70 |
(delete-char 3) |
(delete-char 3) |
71 |
(unless (eq byte ?=) |
(unless (eq byte ?=) |
72 |
(backward-char)))) |
(backward-char)))) |
95 |
If `mm-use-ultra-safe-encoding' is set, fold lines unconditionally and |
If `mm-use-ultra-safe-encoding' is set, fold lines unconditionally and |
96 |
encode lines starting with \"From\"." |
encode lines starting with \"From\"." |
97 |
(interactive "r") |
(interactive "r") |
98 |
;; Fixme: what should this do in XEmacs/Mule? |
(save-excursion |
99 |
(if (fboundp 'find-charset-region) ; else XEmacs, non-Mule |
(goto-char from) |
100 |
(if (delq 'unknown ; Emacs 20 unibyte |
(if (fboundp 'string-to-multibyte) ; Emacs 22 |
101 |
(delq 'eight-bit-graphic ; Emacs 21 |
(if (re-search-forward (string-to-multibyte "[^\x0-\x7f\x80-\xff]") |
102 |
(delq 'eight-bit-control |
to t) |
103 |
(delq 'ascii (find-charset-region from to))))) |
;; Fixme: This is somewhat misleading. |
104 |
(error "Multibyte character in QP encoding region"))) |
(error "Multibyte character in QP encoding region")) |
105 |
|
(if (re-search-forward (mm-string-as-multibyte "[^\0-\377]") to t) |
106 |
|
(error "Multibyte character in QP encoding region")))) |
107 |
(unless class |
(unless class |
108 |
;; Avoid using 8bit characters. = is \075. |
;; Avoid using 8bit characters. = is \075. |
109 |
;; Equivalent to "^\000-\007\013\015-\037\200-\377=" |
;; Equivalent to "^\000-\007\013\015-\037\200-\377=" |
117 |
(not (eobp))) |
(not (eobp))) |
118 |
(insert |
(insert |
119 |
(prog1 |
(prog1 |
120 |
(format "=%02X" (char-after)) |
;; To unibyte in case of Emacs 22 eight-bit. |
121 |
|
(format "=%02X" (mm-multibyte-char-to-unibyte (char-after))) |
122 |
(delete-char 1)))) |
(delete-char 1)))) |
123 |
;; Encode white space at the end of lines. |
;; Encode white space at the end of lines. |
124 |
(goto-char (point-min)) |
(goto-char (point-min)) |