;;; rmailout.el --- "RMAIL" mail reader for Emacs: output message to a file
;; Copyright (C) 1985, 1987, 1993, 1994, 2001, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: mail
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
(or read-file (file-name-nondirectory default-file))
(file-name-directory default-file)))))))
+(declare-function rmail-update-summary "rmailsum" (&rest ignore))
+
;;; There are functions elsewhere in Emacs that use this function;
;;; look at them before you change the calling method.
;;;###autoload
The default file name comes from `rmail-default-rmail-file',
which is updated to the name you use in this command.
-A prefix argument N says to output N consecutive messages
+A prefix argument COUNT says to output that many consecutive messages,
starting with the current one. Deleted messages are skipped and don't count.
-If optional argument STAY is non-nil, then leave the last filed
-mesasge up instead of moving forward to the next non-deleted message."
+If the optional argument STAY is non-nil, then leave the last filed
+message up instead of moving forward to the next non-deleted message."
(interactive
(list (rmail-output-read-rmail-file-name)
(prefix-numeric-value current-prefix-arg)))
;;;###autoload
(defun rmail-output (file-name &optional count noattribute from-gnus)
"Append this message to system-inbox-format mail file named FILE-NAME.
-A prefix argument N says to output N consecutive messages
+A prefix argument COUNT says to output that many consecutive messages,
starting with the current one. Deleted messages are skipped and don't count.
-When called from lisp code, N may be omitted.
+When called from lisp code, COUNT may be omitted and defaults to 1.
If the pruned message header is shown on the current message, then
messages will be appended with pruned headers; otherwise, messages
(mail-fetch-field "sender")
"unknown"))
" " (current-time-string) "\n"))
- (if mime-version
- (insert "MIME-Version: " mime-version
- "\nContent-type: " content-type "\n"))
+ (when mime-version
+ (insert "MIME-Version: " mime-version)
+ ;; Some malformed MIME messages set content-type to nil.
+ (when content-type
+ (insert "\nContent-type: " content-type "\n")))
;; ``Quote'' "\nFrom " as "\n>From "
;; (note that this isn't really quoting, as there is no requirement
;; that "\n[>]+From " be quoted in the same transparent way.)
(rmail-toggle-header))
(if (and (> count 0) (not next-message-p))
(progn
- (error
+ (error "%s"
(save-excursion
(set-buffer rmailbuf)
(format "Only %d message%s appended" num-appended
(goto-char (point-min))
(search-forward "\n\n")
(and (file-exists-p file-name)
- (not (y-or-n-p (message "File %s exists; overwrite? " file-name)))
+ (not (y-or-n-p (format "File %s exists; overwrite? " file-name)))
(error "Operation aborted"))
(write-region (point) (point-max) file-name)
(if (equal major-mode 'rmail-mode)