Merge from emacs--rel--22, gnus--devo--0
[bpt/emacs.git] / lisp / mail / rmailout.el
index d97c181..2342773 100644 (file)
@@ -1,7 +1,7 @@
 ;;; 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
@@ -10,7 +10,7 @@
 
 ;; 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,
@@ -109,6 +109,8 @@ Set `rmail-default-file' to this name as well as returning it."
               (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
@@ -123,11 +125,11 @@ appended in inbox format, the same way `rmail-output' does it.
 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)))
@@ -265,9 +267,9 @@ mesasge up instead of moving forward to the next non-deleted message."
 ;;;###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
@@ -349,9 +351,11 @@ The optional fourth argument FROM-GNUS is set when called from GNUS."
                                                 (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.)
@@ -376,7 +380,7 @@ The optional fourth argument FROM-GNUS is set when called from GNUS."
                  (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
@@ -406,7 +410,7 @@ FILE-NAME defaults, interactively, from the Subject field of the message."
     (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)