Synch to Gnus 200308070200.
[elisp/gnus.git-] / lisp / mail-source.el
index e84f79c..0ae90a8 100644 (file)
@@ -261,7 +261,7 @@ If non-nil, this maildrop will be checked periodically for new mail."
   :group 'mail-source
   :type 'integer)
 
-(defcustom mail-source-delete-incoming nil
+(defcustom mail-source-delete-incoming t
   "*If non-nil, delete incoming files after handling.
 If t, delete immediately, if nil, never delete.  If a positive number, delete
 files older than number of days."
@@ -512,17 +512,6 @@ Return the number of files that were found."
                      (error "Cannot get new mail"))
                    0)))))))))
 
-(eval-and-compile
-  (if (fboundp 'make-temp-file)
-      (defalias 'mail-source-make-complex-temp-name 'make-temp-file)
-    (defun mail-source-make-complex-temp-name (prefix)
-      (let ((newname (make-temp-name prefix))
-           (newprefix prefix))
-       (while (file-exists-p newname)
-         (setq newprefix (concat newprefix "x"))
-         (setq newname (make-temp-name newprefix)))
-       newname))))
-
 (defun mail-source-delete-old-incoming (&optional age confirm)
   "Remove incoming files older than AGE days.
 If CONFIRM is non-nil, ask for confirmation before removing a file."
@@ -567,7 +556,7 @@ Pass INFO on to CALLBACK."
        (if (eq mail-source-delete-incoming t)
            (delete-file mail-source-crash-box)
          (let ((incoming
-                (mail-source-make-complex-temp-name
+                (mm-make-temp-file
                  (expand-file-name
                   mail-source-incoming-file-prefix
                   mail-source-directory))))
@@ -620,7 +609,8 @@ Pass INFO on to CALLBACK."
                (set-file-modes to mail-source-default-file-modes))
              (if (and (or (not (buffer-modified-p errors))
                           (zerop (buffer-size errors)))
-                      (zerop result))
+                      (and (numberp result)
+                           (zerop result)))
                  ;; No output => movemail won.
                  t
                (set-buffer errors)
@@ -1041,7 +1031,7 @@ This only works when `display-time' is enabled."
        (setq mail-source-password-cache
              (delq (assoc from mail-source-password-cache)
                    mail-source-password-cache))
-       (error (imap-error-text buf)))
+       (error "IMAP error: %s" (imap-error-text buf)))
       (kill-buffer buf)
       found)))