comparison lisp/gnus/qp.el @ 34752:f04f551e94ce

* message.el (message-narrow-to-head-1): New function. (message-narrow-to-head): Use it. (message-reply): Ditto. (message-cancel-news): Ditto. (message-supersede): Ditto. (message-make-forward-subject): Ditto. (message-bounce): Ditto. * gnus-msg.el (gnus-summary-mail-forward): Use original buffer. * message.el (message-forward): Copy buffer in unibyte mode. (message-make-forward-subject): Don't widen. Decode. (message-forward): Don't decode subject. * mml.el (gnus-ems): Require it. * gnus-msg.el (gnus-summary-mail-forward): * message.el (message-forward): Move mime-to-mml here. * nnmbox.el (nnmbox-file-coding-system): Use binary. (nnmbox-active-file-coding-system): Ditto. * gnus-cus.el (gnus-group-parameters): Add posting-style. * mm-uu.el: Require binhex. * qp.el (quoted-printable-encode-region): Upcase QP.
author ShengHuo ZHU <zsh@cs.rochester.edu>
date Wed, 20 Dec 2000 20:20:51 +0000
parents 07dcbc7e702f
children a670d2680870
comparison
equal deleted inserted replaced
34751:3a35752ca4cb 34752:f04f551e94ce
87 the form expected by `skip-chars-forward'. 87 the form expected by `skip-chars-forward'.
88 88
89 If `mm-use-ultra-safe-encoding' is set, fold lines unconditionally and 89 If `mm-use-ultra-safe-encoding' is set, fold lines unconditionally and
90 encode lines starting with \"From\"." 90 encode lines starting with \"From\"."
91 (interactive "r") 91 (interactive "r")
92 ;; Fixme: what should this do in XEmacs/Mule?
93 (if (fboundp 'find-charset-region) ; else XEmacs, non-Mule
94 (if (delq 'unknown ; Emacs 20 unibyte
95 (delq 'eight-bit-graphic ; Emacs 21
96 (delq 'eight-bit-control
97 (delq 'ascii (find-charset-region from to)))))
98 (error "Multibyte character in QP encoding region")))
99 (unless class 92 (unless class
100 (setq class "^\000-\007\013\015-\037\200-\377=")) 93 ;; Avoid using 8bit characters. = is \075.
94 ;; Equivalent to "^\000-\007\013\015-\037\200-\377="
95 (setq class "\010-\012\014\040-\074\076-\177"))
101 (if (fboundp 'string-as-multibyte) 96 (if (fboundp 'string-as-multibyte)
102 (setq class (string-as-multibyte class))) 97 (setq class (string-as-multibyte class)))
103 (save-excursion 98 (save-excursion
104 (save-restriction 99 (save-restriction
105 (narrow-to-region from to) 100 (narrow-to-region from to)
106 ;; Encode all the non-ascii and control characters. 101 (mm-with-unibyte-current-buffer-mule4
107 (goto-char (point-min)) 102 ;; Fixme: what should this do in XEmacs/Mule?
108 (while (and (skip-chars-forward class) 103 (if (fboundp 'find-charset-region) ; else XEmacs, non-Mule
109 (not (eobp))) 104 (if (delq 'unknown ; Emacs 20 unibyte
110 (insert 105 (delq 'eight-bit-graphic ; Emacs 21
111 (prog1 106 (delq 'eight-bit-control
112 (format "=%02x" (upcase (char-after))) 107 (delq 'ascii
113 (delete-char 1)))) 108 (find-charset-region from to)))))
114 ;; Encode white space at the end of lines. 109 (error "Multibyte character in QP encoding region")))
115 (goto-char (point-min)) 110 ;; Encode all the non-ascii and control characters.
116 (while (re-search-forward "[ \t]+$" nil t) 111 (goto-char (point-min))
117 (goto-char (match-beginning 0)) 112 (while (and (skip-chars-forward class)
118 (while (not (eolp)) 113 (not (eobp)))
119 (insert 114 (insert
120 (prog1 115 (prog1
121 (format "=%02x" (upcase (char-after))) 116 (format "=%02X" (char-after))
122 (delete-char 1))))) 117 (delete-char 1))))
123 (let ((mm-use-ultra-safe-encoding 118 ;; Encode white space at the end of lines.
124 (and (boundp 'mm-use-ultra-safe-encoding) 119 (goto-char (point-min))
125 mm-use-ultra-safe-encoding))) 120 (while (re-search-forward "[ \t]+$" nil t)
126 (when (or fold mm-use-ultra-safe-encoding) 121 (goto-char (match-beginning 0))
127 ;; Fold long lines. 122 (while (not (eolp))
128 (let ((tab-width 1)) ; HTAB is one character. 123 (insert
129 (goto-char (point-min)) 124 (prog1
130 (while (not (eobp)) 125 (format "=%02X" (char-after))
131 ;; In ultra-safe mode, encode "From " at the beginning 126 (delete-char 1)))))
132 ;; of a line. 127 (let ((mm-use-ultra-safe-encoding
133 (when mm-use-ultra-safe-encoding 128 (and (boundp 'mm-use-ultra-safe-encoding)
134 (beginning-of-line) 129 mm-use-ultra-safe-encoding)))
135 (when (looking-at "From ") 130 (when (or fold mm-use-ultra-safe-encoding)
136 (replace-match "From=20" nil t))) 131 ;; Fold long lines.
137 (end-of-line) 132 (let ((tab-width 1)) ; HTAB is one character.
133 (goto-char (point-min))
134 (while (not (eobp))
135 ;; In ultra-safe mode, encode "From " at the beginning
136 ;; of a line.
137 (when mm-use-ultra-safe-encoding
138 (beginning-of-line)
139 (if (looking-at "From ")
140 (replace-match "From=20" nil t)
141 (if (looking-at "-")
142 (replace-match "=2D" nil t))))
143 (end-of-line)
138 (while (> (current-column) 76) ; tab-width must be 1. 144 (while (> (current-column) 76) ; tab-width must be 1.
139 (beginning-of-line) 145 (beginning-of-line)
140 (forward-char 75) ; 75 chars plus an "=" 146 (forward-char 75) ; 75 chars plus an "="
141 (search-backward "=" (- (point) 2) t) 147 (search-backward "=" (- (point) 2) t)
142 (insert "=\n") 148 (insert "=\n")
143 (end-of-line)) 149 (end-of-line))
144 (unless (eobp) 150 (unless (eobp)
145 (forward-line))))))))) 151 (forward-line))))))))))
146 152
147 (defun quoted-printable-encode-string (string) 153 (defun quoted-printable-encode-string (string)
148 "Encode the STRING as quoted-printable and return the result." 154 "Encode the STRING as quoted-printable and return the result."
149 (with-temp-buffer 155 (with-temp-buffer
150 (insert string) 156 (insert string)