comparison lisp/mail/rmailout.el @ 23042:4404e3d66e80

(rmail-output): Always preserve MIME-Version field, even if it was pruned.
author Richard M. Stallman <rms@gnu.org>
date Sun, 16 Aug 1998 06:59:13 +0000
parents 1e47dd38609d
children 3bb7a66a51a8
comparison
equal deleted inserted replaced
23041:34837f8d560c 23042:4404e3d66e80
38 (choice :value "" 38 (choice :value ""
39 (string :tag "File Name") 39 (string :tag "File Name")
40 sexp))) 40 sexp)))
41 :group 'rmail-output) 41 :group 'rmail-output)
42 42
43 ;;; There are functions elsewhere in Emacs that use this function; check 43 ;;; There are functions elsewhere in Emacs that use this function;
44 ;;; them out before you change the calling method. 44 ;;; look at them before you change the calling method.
45 ;;;###autoload 45 ;;;###autoload
46 (defun rmail-output-to-rmail-file (file-name &optional count) 46 (defun rmail-output-to-rmail-file (file-name &optional count)
47 "Append the current message to an Rmail file named FILE-NAME. 47 "Append the current message to an Rmail file named FILE-NAME.
48 If the file does not exist, ask if it should be created. 48 If the file does not exist, ask if it should be created.
49 If file is being visited, the message is appended to the Emacs 49 If file is being visited, the message is appended to the Emacs
204 (while (re-search-forward rmail-fields-not-to-output end t) 204 (while (re-search-forward rmail-fields-not-to-output end t)
205 (beginning-of-line) 205 (beginning-of-line)
206 (delete-region (point) 206 (delete-region (point)
207 (progn (forward-line 1) (point))))))))) 207 (progn (forward-line 1) (point)))))))))
208 208
209 ;;; There are functions elsewhere in Emacs that use this function; check 209 ;;; There are functions elsewhere in Emacs that use this function;
210 ;;; them out before you change the calling method. 210 ;;; look at them before you change the calling method.
211 ;;;###autoload 211 ;;;###autoload
212 (defun rmail-output (file-name &optional count noattribute from-gnus) 212 (defun rmail-output (file-name &optional count noattribute from-gnus)
213 "Append this message to system-inbox-format mail file named FILE-NAME. 213 "Append this message to system-inbox-format mail file named FILE-NAME.
214 A prefix argument N says to output N consecutive messages 214 A prefix argument N says to output N consecutive messages
215 starting with the current one. Deleted messages are skipped and don't count. 215 starting with the current one. Deleted messages are skipped and don't count.
272 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max)) 272 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max))
273 (goto-char (point-min)) 273 (goto-char (point-min))
274 (forward-line 1) 274 (forward-line 1)
275 (= (following-char) ?0))))) 275 (= (following-char) ?0)))))
276 header-beginning 276 header-beginning
277 mail-from) 277 mail-from mime-version)
278 (while (> count 0) 278 (while (> count 0)
279 ;; Preserve the Mail-From and MIME-Version fields
280 ;; even if they have been pruned.
279 (or from-gnus 281 (or from-gnus
280 (setq mail-from 282 (save-excursion
281 (save-excursion 283 (save-restriction
282 (save-restriction 284 (widen)
283 (widen) 285 (goto-char (rmail-msgbeg rmail-current-message))
284 (goto-char (rmail-msgbeg rmail-current-message)) 286 (setq header-beginning (point))
285 (setq header-beginning (point)) 287 (search-forward "\n*** EOOH ***\n")
286 (search-forward "\n*** EOOH ***\n") 288 (narrow-to-region header-beginning (point))
287 (narrow-to-region header-beginning (point)) 289 (setq mail-from
288 (mail-fetch-field "Mail-From"))))) 290 (mail-fetch-field "Mail-From")
291 mime-version
292 (mail-fetch-field "MIME-Version")))))
289 (save-excursion 293 (save-excursion
290 (set-buffer tembuf) 294 (set-buffer tembuf)
291 (erase-buffer) 295 (erase-buffer)
292 (insert-buffer-substring rmailbuf) 296 (insert-buffer-substring rmailbuf)
293 (rmail-delete-unwanted-fields t) 297 (rmail-delete-unwanted-fields t)
299 (mail-strip-quoted-names (or (mail-fetch-field "from") 303 (mail-strip-quoted-names (or (mail-fetch-field "from")
300 (mail-fetch-field "really-from") 304 (mail-fetch-field "really-from")
301 (mail-fetch-field "sender") 305 (mail-fetch-field "sender")
302 "unknown")) 306 "unknown"))
303 " " (current-time-string) "\n")) 307 " " (current-time-string) "\n"))
308 (if mime-version
309 (insert "MIME-Version: " mime-version "\n"))
304 ;; ``Quote'' "\nFrom " as "\n>From " 310 ;; ``Quote'' "\nFrom " as "\n>From "
305 ;; (note that this isn't really quoting, as there is no requirement 311 ;; (note that this isn't really quoting, as there is no requirement
306 ;; that "\n[>]+From " be quoted in the same transparent way.) 312 ;; that "\n[>]+From " be quoted in the same transparent way.)
307 (let ((case-fold-search nil)) 313 (let ((case-fold-search nil))
308 (while (search-forward "\nFrom " nil t) 314 (while (search-forward "\nFrom " nil t)